zs 1 年之前
父節點
當前提交
7c373ecad8

+ 2 - 0
src/entity/application.entity.ts

@@ -10,6 +10,8 @@ export class Application extends BaseModel {
   match_name: string;
   @prop({ required: false, index: true, zh: '团队id' })
   team_id: string;
+  @prop({ required: false, index: true, zh: '所属管理员' })
+  administrator: string;
   @prop({ required: false, index: true, zh: '团队名称' })
   team_name: string;
   @prop({ required: false, index: true, zh: '参赛人数' })

+ 9 - 1
src/interface/application.interface.ts

@@ -18,6 +18,8 @@ export class FVO_application {
   'match_id': string = undefined;
   @ApiProperty({ description: '报名比赛名称' })
   'match_name': string = undefined;
+  @ApiProperty({ description: '所属管理员' })
+  'administrator': string = undefined;
   @ApiProperty({ description: '团队id' })
   'team_id': string = undefined;
   @ApiProperty({ description: '团队名称' })
@@ -40,6 +42,7 @@ export class QDTO_application extends SearchBase {
     const props = [
       'match_id',
       'match_name',
+      'administrator',
       'team_id',
       'team_name',
       'num',
@@ -54,6 +57,8 @@ export class QDTO_application extends SearchBase {
   'match_id': string = undefined;
   @ApiProperty({ description: '报名比赛名称' })
   'match_name': string = undefined;
+  @ApiProperty({ description: '所属管理员' })
+  'administrator': string = undefined;
   @ApiProperty({ description: '团队id' })
   'team_id': string = undefined;
   @ApiProperty({ description: '团队名称' })
@@ -82,9 +87,12 @@ export class CDTO_application {
   @ApiProperty({ description: '报名比赛名称' })
   @Rule(RuleType['string']().allow('', null))
   'match_name': string = undefined;
-  @ApiProperty({ description: '团队id' })
+  @ApiProperty({ description: '所属管理员' })
   @Rule(RuleType['string']().allow('', null))
   'team_id': string = undefined;
+  @ApiProperty({ description: '团队id' })
+  @Rule(RuleType['string']().allow('', null))
+  'administrator': string = undefined;
   @ApiProperty({ description: '团队名称' })
   @Rule(RuleType['string']().allow('', null))
   'team_name': string = undefined;

+ 3 - 8
src/service/application.service.ts

@@ -82,15 +82,10 @@ export class ApplicationService extends BaseService<modelType> {
         const total = await this.model.count(info);
         return { list, total };
       } else if (user.type === '1') {
-        const list = [];
-        const user_id = info.user;
+        info.administrator = info.user;
         delete info.user;
-        const data: any = await this.model.find(info).skip(skip).limit(limit);
-        for (const val of data) {
-          const team = await this.TeamModel.findById(val.team_id);
-          if (team.administrator === user_id) list.push(val);
-        }
-        const total = list.length;
+        const list: any = await this.model.find(info).skip(skip).limit(limit);
+        const total = await this.model.count(info);
         return { list, total };
       }
     } else {

+ 0 - 1
src/service/course.service.ts

@@ -19,7 +19,6 @@ export class CourseService extends BaseService<modelType> {
     let obj = {};
     if (info.team_id) {
       obj = {
-        ...info,
         $or: [
           { red_team_id: { $eq: info.team_id } },
           { blue_team_id: { $eq: info.team_id } },