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