Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4163f1ce5 | |||
| d1e7d02a3c | |||
| 81bb8e7b98 | |||
| b822215c04 | |||
| 74e6565c27 | |||
| 0b6b551921 | |||
| ace749b742 | |||
| 75cb542795 |
@@ -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()
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user