Skip to content

Commit

Permalink
Merge pull request #130 from gsainfoteam/103-hsm
Browse files Browse the repository at this point in the history
[feature] make recent orderBy updatedAt
  • Loading branch information
han299792 authored Nov 20, 2024
2 parents b769043 + 13c2c6d commit 82e5b9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ model Notice {
category Category @default(ETC)
currentDeadline DateTime? @map("current_deadline")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
updatedAt DateTime @default(now()) @map("updated_at") @updatedAt
publishedAt DateTime @map("published_at")
deletedAt DateTime? @map("deleted_at")
Expand Down
5 changes: 3 additions & 2 deletions src/notice/notice.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class NoticeRepository {
orderBy: {
currentDeadline: orderBy === 'deadline' ? 'asc' : undefined,
views: orderBy === 'hot' ? 'desc' : undefined,
createdAt: orderBy === 'recent' ? 'desc' : undefined,
updatedAt: orderBy === 'recent' ? 'desc' : undefined,
},
where: {
...(orderBy === 'deadline'
Expand Down Expand Up @@ -206,7 +206,7 @@ export class NoticeRepository {
orderBy: {
currentDeadline: orderBy === 'deadline' ? 'asc' : undefined,
views: orderBy === 'hot' ? 'desc' : undefined,
createdAt: orderBy === 'recent' ? 'desc' : undefined,
updatedAt: orderBy === 'recent' ? 'desc' : undefined,
},
where: {
...(orderBy === 'deadline'
Expand Down Expand Up @@ -564,6 +564,7 @@ export class NoticeRepository {
},
},
currentDeadline: deadline ?? notice.currentDeadline,
updatedAt: new Date(),
},
})
.catch((error) => {
Expand Down

0 comments on commit 82e5b9b

Please sign in to comment.