163 lines
3.9 KiB
JavaScript
163 lines
3.9 KiB
JavaScript
import RecordingDataMini from '../../models/file/recording_data_mini'
|
|
import * as auth from '../auth'
|
|
|
|
const recordingDataMini = new RecordingDataMini()
|
|
|
|
export const create = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const data = ctx.request.body
|
|
console.log(auth.CheckAuth(ctx))
|
|
// console.log(ctx.request.header.authorization)
|
|
const result = await recordingDataMini.create(data, index)
|
|
// console.log(result)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const update = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const data = ctx.request.body
|
|
const id = ctx.params.id
|
|
const result = await recordingDataMini.update(data, id, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const updateByIDs = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const data = ctx.request.body
|
|
const id = ctx.params.id
|
|
const result = await recordingDataMini.updateByIDs(data, id, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
// export const get = async (ctx, next) => {
|
|
// const index = ctx.params.channel
|
|
// const id = ctx.params.id
|
|
// const result = await recordingDataMini.getByID(id, index)
|
|
// ctx.body = result
|
|
|
|
// next()
|
|
// }
|
|
|
|
export const clearDeleted = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const result = await recordingDataMini.clearDeleted(index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getByID = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const id = ctx.params.id
|
|
const result = await recordingDataMini.getByID(id, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getByIDs = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const id = ctx.params.id
|
|
const result = await recordingDataMini.getByIDs(id, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getMeanDataByID = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const id = ctx.params.id
|
|
const result = await recordingDataMini.getMeanDataByID(id, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getRandomDataByID = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const id = ctx.params.id
|
|
const result = await recordingDataMini.getRandomDataByID(id, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getByParent = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const parent = ctx.params.parent
|
|
const result = await recordingDataMini.getByParent(parent, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getAttrByID = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const id = ctx.params.id
|
|
const attr = ctx.params.attr
|
|
const result = await recordingDataMini.getByAttrID(id, attr, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getAttrByParent = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const parent = ctx.params.parent
|
|
const attr = ctx.params.attr
|
|
const result = await recordingDataMini.getByAttrParent(parent, attr, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getByUUID = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const uuid = ctx.params.uuid
|
|
const result = await recordingDataMini.getByUUID(uuid, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getByName = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const name = ctx.params.name
|
|
const result = await recordingDataMini.getByName(name, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getByPath = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const path = ctx.params.path
|
|
const result = await recordingDataMini.getByPath(path, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getOrCreateByPath = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const path = ctx.params.path
|
|
const result = await recordingDataMini.findOrCreateByPath(path, index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|
|
|
|
export const getAll = async (ctx, next) => {
|
|
const index = ctx.params.channel
|
|
const result = await recordingDataMini.getAll(index)
|
|
ctx.body = result
|
|
|
|
next()
|
|
}
|