fix nullable description
This commit is contained in:
@@ -11,6 +11,7 @@ describe("POST /admin/discounts", () => {
|
||||
payload: {
|
||||
code: "TEST",
|
||||
rule: {
|
||||
description: "Test",
|
||||
type: "fixed",
|
||||
value: 10,
|
||||
allocation: "total",
|
||||
@@ -33,6 +34,7 @@ describe("POST /admin/discounts", () => {
|
||||
expect(DiscountServiceMock.create).toHaveBeenCalledWith({
|
||||
code: "TEST",
|
||||
rule: {
|
||||
description: "Test",
|
||||
type: "fixed",
|
||||
value: 10,
|
||||
allocation: "total",
|
||||
@@ -51,6 +53,7 @@ describe("POST /admin/discounts", () => {
|
||||
payload: {
|
||||
code: "10%OFF",
|
||||
rule: {
|
||||
description: "Test",
|
||||
value: 10,
|
||||
allocation: "total",
|
||||
},
|
||||
|
||||
@@ -14,6 +14,12 @@ export class discountUsage1617002207608 implements MigrationInterface {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "discount" ADD "usage_count" integer NOT NULL DEFAULT '0'`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "discount_rule" ALTER COLUMN "description" DROP NOT NULL`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "discount_rule"."description" IS NULL`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
@@ -25,5 +31,11 @@ export class discountUsage1617002207608 implements MigrationInterface {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "discount_rule" ADD "usage_limit" integer`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "discount_rule"."description" IS NULL`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "discount_rule" ALTER COLUMN "description" SET NOT NULL`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class DiscountRule {
|
||||
@PrimaryColumn()
|
||||
id: string
|
||||
|
||||
@Column()
|
||||
@Column({ nullable: true })
|
||||
description: string
|
||||
|
||||
@Column({
|
||||
|
||||
Reference in New Issue
Block a user