|
@@ -1,4 +1,3 @@
|
|
-import { MatchService } from '../../service/platform/match.service';
|
|
|
|
import { CVO_match, FVO_match, QVO_match, UVAO_match } from '../../interface/platform/match.interface';
|
|
import { CVO_match, FVO_match, QVO_match, UVAO_match } from '../../interface/platform/match.interface';
|
|
import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
|
|
import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
|
|
import { Validate } from '@midwayjs/validate';
|
|
import { Validate } from '@midwayjs/validate';
|
|
@@ -43,13 +42,13 @@ export class MatchRegistrationController implements BaseController {
|
|
@Validate()
|
|
@Validate()
|
|
@ApiResponse({ type: CVO_match })
|
|
@ApiResponse({ type: CVO_match })
|
|
async create(@Body() data: object) {
|
|
async create(@Body() data: object) {
|
|
- const userColumns = ['user', 'user_id']
|
|
|
|
- let regData = omit(data, userColumns)
|
|
|
|
|
|
+ const userColumns = ['user', 'user_id'];
|
|
|
|
+ let regData = omit(data, userColumns);
|
|
if (get(data, 'user_id')) {
|
|
if (get(data, 'user_id')) {
|
|
- regData = { user_id: get(data, 'user_id'), ...regData }
|
|
|
|
|
|
+ regData = { user_id: get(data, 'user_id'), ...regData };
|
|
} else {
|
|
} else {
|
|
- const user = get(data, 'user')
|
|
|
|
- if (!user) throw new ServiceError(ErrorCode.MATCH_NEED_USER_INFO)
|
|
|
|
|
|
+ const user = get(data, 'user');
|
|
|
|
+ if (!user) throw new ServiceError(ErrorCode.MATCH_NEED_USER_INFO);
|
|
// 注册用户
|
|
// 注册用户
|
|
await this.userService.createExamine(user);
|
|
await this.userService.createExamine(user);
|
|
await this.userService.checkPhone(user);
|
|
await this.userService.checkPhone(user);
|
|
@@ -62,7 +61,7 @@ export class MatchRegistrationController implements BaseController {
|
|
Object.assign(user, { password: hash });
|
|
Object.assign(user, { password: hash });
|
|
}
|
|
}
|
|
const dbData = await this.userService.create(user);
|
|
const dbData = await this.userService.create(user);
|
|
- regData = { user_id: dbData.id, ...regData }
|
|
|
|
|
|
+ regData = { user_id: dbData.id, ...regData };
|
|
}
|
|
}
|
|
// 检查是否报名
|
|
// 检查是否报名
|
|
const query = { match_id: get(data, 'match_id'), user_id: get(regData, 'user_id') }
|
|
const query = { match_id: get(data, 'match_id'), user_id: get(regData, 'user_id') }
|
|
@@ -98,7 +97,7 @@ export class MatchRegistrationController implements BaseController {
|
|
@Get('/detail/:id')
|
|
@Get('/detail/:id')
|
|
@ApiResponse({ type: FVO_match })
|
|
@ApiResponse({ type: FVO_match })
|
|
async detail(@Param('id') id: string) {
|
|
async detail(@Param('id') id: string) {
|
|
- let data = await this.service.fetch({ id });
|
|
|
|
|
|
+ const data = await this.service.fetch({ id });
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|
|
}
|
|
}
|