|
@@ -24,4 +24,20 @@ export default class TextRecordController {
|
|
|
// const payload = request.only(['deviceId', 'appName', 'record'])
|
|
// const payload = request.only(['deviceId', 'appName', 'record'])
|
|
|
return await TextRecord.create(request.all())
|
|
return await TextRecord.create(request.all())
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public async update({ request, params, bouncer }: HttpContextContract) {
|
|
|
|
|
+ await bouncer.authorize('admin')
|
|
|
|
|
+ const payload = await request.validate({
|
|
|
|
|
+ schema: schema.create({
|
|
|
|
|
+ deviceId: schema.string.optional(),
|
|
|
|
|
+ appName: schema.string.optional(),
|
|
|
|
|
+ record: schema.string.optional(),
|
|
|
|
|
+ password: schema.string.optional()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ const record = await TextRecord.findOrFail(params.id)
|
|
|
|
|
+ record.merge(payload)
|
|
|
|
|
+ await record.save()
|
|
|
|
|
+ return record
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|