zs 1 tahun lalu
induk
melakukan
372e61f3e7

+ 13 - 0
src/controller/application.controller.ts

@@ -19,6 +19,7 @@ import {
   UDTO_application,
   UVAO_application,
 } from '../interface/application.interface';
+import { QVO_team } from '../interface/team.interface';
 import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
 import { Validate } from '@midwayjs/validate';
 @ApiTags(['比赛报名'])
@@ -51,6 +52,18 @@ export class ApplicationController extends BaseController {
     return { data, total };
   }
 
+  @Get('/team')
+  async team(@Query() filter: any) {
+    const list = await this.service.teamQuery(filter);
+    const data = [];
+    for (const i of list.list) {
+      const newData = new QVO_team(i);
+      data.push(newData);
+    }
+    const total = list.total;
+    return { data, total };
+  }
+
   @Get('/:id')
   @ApiResponse({ type: FVO_application })
   async fetch(@Param('id') id: string) {

+ 14 - 0
src/service/application.service.ts

@@ -94,4 +94,18 @@ export class ApplicationService extends BaseService<modelType> {
       return { list, total };
     }
   }
+  async teamQuery(filter) {
+    const { skip = 0, limit = 0, ...info } = filter;
+    const data: any = await this.model.find(info);
+    const team = data.map(i => {
+      return i.team_id;
+    });
+    const list = [];
+    for (const val of team) {
+      const data = await this.TeamModel.findById(val);
+      list.push(data);
+    }
+    const total = list.length;
+    return { list, total };
+  }
 }