|
@@ -0,0 +1,22 @@
|
|
|
|
|
+import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
|
|
|
|
+import PaginationService from 'App/Services/PaginationService'
|
|
|
|
|
+import { schema } from '@ioc:Adonis/Core/Validator'
|
|
|
|
|
+import OcrRecord from 'App/Models/OcrRecord'
|
|
|
|
|
+
|
|
|
|
|
+export default class OcrRecordController {
|
|
|
|
|
+ private paginationService = new PaginationService(OcrRecord)
|
|
|
|
|
+
|
|
|
|
|
+ public async index({ request }: HttpContextContract) {
|
|
|
|
|
+ return await this.paginationService.paginate(request.all())
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public async store({ request, bouncer }: HttpContextContract) {
|
|
|
|
|
+ await request.validate({
|
|
|
|
|
+ schema: schema.create({
|
|
|
|
|
+ deviceId: schema.string(),
|
|
|
|
|
+ record: schema.string()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ return await OcrRecord.create(request.all())
|
|
|
|
|
+ }
|
|
|
|
|
+}
|