|
@@ -6,6 +6,7 @@ import { DateTime } from 'luxon'
|
|
|
import Database from '@ioc:Adonis/Lucid/Database'
|
|
import Database from '@ioc:Adonis/Lucid/Database'
|
|
|
import User, { UserRoles } from 'App/Models/User'
|
|
import User, { UserRoles } from 'App/Models/User'
|
|
|
import UserService from 'App/Services/UserService'
|
|
import UserService from 'App/Services/UserService'
|
|
|
|
|
+import * as console from 'node:console'
|
|
|
|
|
|
|
|
export default class OcrChannelController {
|
|
export default class OcrChannelController {
|
|
|
private paginationService = new PaginationService(OcrChannel)
|
|
private paginationService = new PaginationService(OcrChannel)
|
|
@@ -318,4 +319,21 @@ export default class OcrChannelController {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public async getChannelOcrLevel({ params, response }: HttpContextContract) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const { name } = params
|
|
|
|
|
+ if (!name) {
|
|
|
|
|
+ return response.ok({ level: 0 })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const ocrChannel = await OcrChannel.findBy('name', name)
|
|
|
|
|
+ if (!ocrChannel) {
|
|
|
|
|
+ return response.ok({ level: 0 })
|
|
|
|
|
+ }
|
|
|
|
|
+ return response.ok({ level: ocrChannel.ocrLevel })
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ return response.ok({ level: 0 })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|