Compare commits

...

8 Commits

Author SHA1 Message Date
Tommy Huang c4163f1ce5 fix db sd_raw type error 2022-01-27 15:59:56 +08:00
Tommy Huang d1e7d02a3c Merge remote-tracking branch 'origin/feature/sd_data' into feature/sd_data 2022-01-27 11:22:53 +08:00
Tommy Huang 81bb8e7b98 sd_raw time split sec and micro 2022-01-27 11:22:47 +08:00
peterlu14 b822215c04 [fix] typo 2022-01-26 17:21:46 +08:00
Tommy Huang 74e6565c27 fix sd_raw modal 2022-01-26 17:14:01 +08:00
tommy830509 0b6b551921 sd_raw_meulive freezeTableName 2022-01-24 18:58:11 +08:00
Tommy Huang ace749b742 prefix bps_sd_raw_neulive 2022-01-24 17:15:51 +08:00
Tommy Huang 75cb542795 DB sd_raw_neulive 2022-01-24 17:08:48 +08:00
4 changed files with 106 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import SDRawNeulive from '../../models/file/sd_raw_neulive'
import * as auth from '../auth'
const sd_raw_Neulive = new SDRawNeulive()
export const create = async (ctx, next) => {
const data = ctx.request.body
const result = await sd_raw_Neulive.create(data)
ctx.body = result
next()
}
export const getByParentUUID = async (ctx, next) => {
const parent_uuid = ctx.params.parent_uuid
const result = await sd_raw_Neulive.getByParentUUID(parent_uuid)
ctx.body = result
next()
}
export const deleteByParentUUID = async (ctx, next) => {
const parent_uuid = ctx.params.parent_uuid
const result = await sd_raw_Neulive.deleteByParentUUID(parent_uuid)
ctx.body = result
next()
}
+2
View File
@@ -41,6 +41,8 @@ for (let i = 256; i < 288; i++) {
db[i + '_recording_data_minis'] = require('./schema/recording_data_mini.model')(sequelize, Sequelize, i)
}
db.sd_raw_neulive = require('./schema/sd_raw_neulive.model')(sequelize, Sequelize)
db.sequelize.sync()
sequelizeStream(db.sequelize, 1000)
+37
View File
@@ -0,0 +1,37 @@
module.exports = (sequelize, Sequelize, i) => {
const RecordingDataRaw = sequelize.define('bps_sd_raw_neulive', {
channel: {
type: Sequelize.INTEGER
},
parent_uuid: {
type: Sequelize.STRING,
},
data: {
type: Sequelize.TEXT,
defaultValue: ''
},
start_time_sec: {
type: Sequelize.INTEGER,
defaultValue: 0
},
end_time_sec: {
type: Sequelize.INTEGER,
defaultValue: 0
},
start_time_micro: {
type: Sequelize.INTEGER,
defaultValue: 0
},
end_time_micro: {
type: Sequelize.INTEGER,
defaultValue: 0
}
},
{
freezeTableName: true,
timestamps: false
}
)
return RecordingDataRaw
}
+42
View File
@@ -0,0 +1,42 @@
const db = require('../../db/database')
class SDRawNeulive {
async create (req) {
return db['sd_raw_neulive'].create(
req
)
}
async getByParentUUID (parent_uuid) {
const ret = await db['sd_raw_neulive'].findAllWithStream(
{
batchSize: 1000,
where: {
parent_uuid: parent_uuid
},
order: [
['id', 'ASC']
],
attributes: [
'data',
'start_time',
'end_time'
]
}
)
return ret
}
async deleteByParentUUID (parent_uuid) {
const ret = await db['sd_raw_neulive'].destroy(
{
where: {
parent_uuid: parent_uuid
}
}
)
return ret
}
}
export default SDRawNeulive