Sfoglia il codice sorgente

feat(database): 在 ocr_records表中添加 img 字段并更新相关路由

- 在 ocr_records 表中添加 img 字段,用于存储 OCR 图像路径
- 更新 OcrRecord 模型,添加 img 属性
- 新增 /ocrImg/upload 路由,用于上传 OCR 图像
wui 10 mesi fa
parent
commit
2a4cc90490

+ 3 - 0
app/Models/OcrRecord.ts

@@ -15,6 +15,9 @@ export default class OcrRecord extends AppBaseModel {
     @column()
     public channel: string
 
+    @column()
+    public img: string
+
     @column.dateTime({ autoCreate: true })
     public createdAt: DateTime
 

+ 1 - 0
database/migrations/1740971717297_ocr_records.ts → database/migrations/1740987471879_ocr_records.ts

@@ -9,6 +9,7 @@ export default class extends BaseSchema {
             table.string('device_id').notNullable()
             table.text('record').notNullable()
             table.string('channel').notNullable()
+            table.string('img').notNullable()
             table.timestamp('created_at', { useTz: true })
             table.timestamp('updated_at', { useTz: true })
         })

+ 4 - 0
start/routes.ts

@@ -112,4 +112,8 @@ Route.group(() => {
         Route.get('ocrRecord', 'OcrRecordController.index').middleware('auth:api')
         Route.post('ocrRecord', 'OcrRecordController.store')
     })
+
+    Route.group(() => {
+        Route.post('upload', 'FilesController.store')
+    }).prefix('/ocrImg')
 }).prefix('/api')