zs 1 år sedan
förälder
incheckning
9a092f1a48
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      src/service/application.service.ts

+ 4 - 1
src/service/application.service.ts

@@ -12,6 +12,8 @@ import { Match } from '../entity/match.entity';
 import { User } from '../entity/user.entity';
 import { Team } from '../entity/team.entity';
 const moment = require('moment');
+import isEqual = require('lodash/isEqual');
+import uniqWith = require('lodash/uniqWith');
 type modelType = ReturnModelType<typeof Application>;
 @Provide()
 export class ApplicationService extends BaseService<modelType> {
@@ -98,9 +100,10 @@ export class ApplicationService extends BaseService<modelType> {
   async teamQuery(filter) {
     const { skip = 0, limit = 0, ...info } = filter;
     const data: any = await this.model.find(info);
-    const team = data.map(i => {
+    let team = data.map(i => {
       return i.team_id;
     });
+    team = uniqWith(team, isEqual);
     const res = [];
     for (const val of team) {
       const data = await this.TeamModel.findById(val);