|
@@ -12,8 +12,6 @@ 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> {
|
|
@@ -76,14 +74,18 @@ export class ApplicationService extends BaseService<modelType> {
|
|
|
async specialQuery(filter) {
|
|
|
const { skip = 0, limit = 0, ...info } = filter;
|
|
|
if (info.user) {
|
|
|
+ // 查询用户信息
|
|
|
const user = await this.UserModel.findById(info.user);
|
|
|
+ // 判断用户类型
|
|
|
if (user.type === '0') {
|
|
|
+ // 如何是比赛人员 查询成员中是否包含该用户
|
|
|
info.user_id = { $elemMatch: { _id: info.user } };
|
|
|
delete info.user;
|
|
|
const list: any = await this.model.find(info).skip(skip).limit(limit);
|
|
|
const total = await this.model.count(info);
|
|
|
return { list, total };
|
|
|
} else if (user.type === '1') {
|
|
|
+ // 如何团队管理人员 查询所属管理人员
|
|
|
info.administrator = info.user;
|
|
|
delete info.user;
|
|
|
const list: any = await this.model.find(info).skip(skip).limit(limit);
|
|
@@ -91,6 +93,7 @@ export class ApplicationService extends BaseService<modelType> {
|
|
|
return { list, total };
|
|
|
}
|
|
|
} else {
|
|
|
+ // 没有用户信息正常查询
|
|
|
const list: any = await this.model.find(info).skip(skip).limit(limit);
|
|
|
const total = await this.model.count(info);
|
|
|
return { list, total };
|