Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
fix : 규칙 수정 저장 시, 번호 정렬 (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
yewonahn authored Feb 12, 2024
2 parents 1b569df + 10933b6 commit cb39ccc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rule/dto/update-rule.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export class UpdateRulePairDto {
@IsNumber()
id: number;

@IsNotEmpty()
@IsNumber()
ruleNumber: number;

@IsNotEmpty()
@IsString()
ruleTitle: string;
Expand Down
4 changes: 4 additions & 0 deletions src/rule/rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ export class RuleService {
// 검색 결과에 해당하는 값 찾기
// 해당 결과값을 name 혹은 nickName 에 포함하고 있는 사용자 찾기
// { id: Not(Equal(userId))} // 사용자 본인은 검색결과에 뜨지 않도록


console.log('검색 값: ', searchTerm);
const [resultUsers, total] = await UserEntity.findAndCount({
take: cursorPageOptionsDto.take,
Expand Down Expand Up @@ -499,6 +501,8 @@ export class RuleService {
relations: { rules: true, invitations: {member : true} }
})

updateRuleDto.rulePairs.sort((a, b) => a.ruleNumber - b.ruleNumber);

rule.mainTitle = updateRuleDto.mainTitle
await rule.save();

Expand Down

0 comments on commit cb39ccc

Please sign in to comment.