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

Commit

Permalink
fix : 규칙 정렬을 위한 ruleNumber 추가 (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
yewonahn authored Feb 12, 2024
2 parents f958183 + 4a5bc86 commit 1b569df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rule/dto/create-rule.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { IsNotEmpty, IsNumber, IsString, IsArray, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
class RulePairDto {
@IsNotEmpty()
@IsNumber()
ruleNumber: number;

@IsNotEmpty()
@IsString()
ruleTitle: string;
Expand Down
2 changes: 2 additions & 0 deletions src/rule/rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export class RuleService {
await main.save();
console.log(main);

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

// -2) rule 저장
const subs = await Promise.all(dto.rulePairs.map(async (pair) => {
const sub = new RuleSubEntity();
Expand Down

0 comments on commit 1b569df

Please sign in to comment.