Skip to content

Commit

Permalink
Merge pull request Quickchive#179 from hou27/feature/Quickchive#161-u…
Browse files Browse the repository at this point in the history
…pdate-read-deadline-name-to-reminder

Feature/Quickchive#161 update read deadline name to reminder
  • Loading branch information
hou27 authored Mar 14, 2023
2 parents 3697d4e + e5e70be commit cee5d2f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/batch/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class TaskService {
});
const contents = await this.contents.find({
where: {
deadline: utcToday,
reminder: utcToday,
},
relations: {
user: true,
Expand Down
8 changes: 4 additions & 4 deletions src/contents/contents.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ContentsService {
link,
title,
comment,
deadline,
reminder,
favorite,
categoryName,
parentId,
Expand Down Expand Up @@ -113,7 +113,7 @@ export class ContentsService {
coverImg,
description,
comment,
deadline,
reminder,
...(category && { category }),
user,
...(favorite && { favorite }),
Expand Down Expand Up @@ -196,7 +196,7 @@ export class ContentsService {
title,
description,
comment,
deadline,
reminder,
favorite,
categoryName,
parentId,
Expand All @@ -208,7 +208,7 @@ export class ContentsService {
title,
description,
comment,
deadline,
reminder,
favorite,
};
try {
Expand Down
2 changes: 1 addition & 1 deletion src/contents/dtos/content.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CoreOutput } from '../../common/dtos/output.dto';
import { Content } from '../entities/content.entity';

class ContentBodyExceptLink extends PartialType(
PickType(Content, ['title', 'comment', 'deadline', 'favorite']),
PickType(Content, ['title', 'comment', 'reminder', 'favorite']),
) {
@ApiProperty({ description: 'Category Name', required: false })
@IsString()
Expand Down
4 changes: 2 additions & 2 deletions src/contents/entities/content.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export class Content extends CoreEntity {

@ApiProperty({
example: '2022-08-20',
description: 'Article Deadline(YYYY-MM-DD HH:mm:ss)',
description: 'Article Reminder Date(YYYY-MM-DD HH:mm:ss)',
required: false,
})
@Column({ nullable: true })
@IsDate()
@IsOptional()
@Transform(({ value }) => new Date(value))
deadline?: Date;
reminder?: Date;

@ApiProperty({ description: 'Favorite' })
@Column({ default: false })
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class updateReadDeadlineNameToReminder1678797251031 implements MigrationInterface {
name = 'updateReadDeadlineNameToReminder1678797251031'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "content" RENAME COLUMN "deadline" TO "reminder"`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "content" RENAME COLUMN "reminder" TO "deadline"`);
}

}

0 comments on commit cee5d2f

Please sign in to comment.