|
@@ -12,8 +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> {
|
|
@@ -96,27 +96,27 @@ 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);
|
|
|
- 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);
|
|
|
- if (data) res.push(data);
|
|
|
- }
|
|
|
- const list = this.pagination(skip, limit, res);
|
|
|
- const total = list.length;
|
|
|
- return { list, total };
|
|
|
- }
|
|
|
- pagination(pageNo, pageSize, array) {
|
|
|
- const offset = pageNo * pageSize;
|
|
|
- return offset + pageSize >= array.length
|
|
|
- ? array.slice(offset, array.length)
|
|
|
- : array.slice(offset, offset + pageSize);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|