Skip to content

Commit

Permalink
chore: improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
wjw-gavin committed Apr 14, 2023
1 parent 2250ca6 commit 4da9327
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cats/cats.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class CatsService {
const now = format(Date.now(), 'yyyy-MM-dd HH:mm:ss')
createCatDto.createTime = now
createCatDto.updateTime = now

return this.catModel.create(createCatDto)
}

Expand All @@ -26,6 +27,7 @@ export class CatsService {
async update(id: string, updateCatDto: Cat): Promise<any> {
const now = format(Date.now(), 'yyyy-MM-dd HH:mm:ss')
updateCatDto.updateTime = now

return this.catModel.findByIdAndUpdate(id, updateCatDto, {
returnDocument: 'after'
})
Expand Down

0 comments on commit 4da9327

Please sign in to comment.