-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16eb791
commit 13846aa
Showing
35 changed files
with
60 additions
and
494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class DropAddress1699290758562 implements MigrationInterface { | ||
name = 'DropAddress1699290758562' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "customer" DROP CONSTRAINT "FK_7697a356e1f4b79ab3819839e95"`); | ||
await queryRunner.query(`ALTER TABLE "cooperative" DROP CONSTRAINT "FK_76076f95b4afaa794ca4a974661"`); | ||
await queryRunner.query(`ALTER TABLE "customer" DROP COLUMN "addressId"`); | ||
await queryRunner.query(`ALTER TABLE "cooperative" DROP COLUMN "addressId"`); | ||
await queryRunner.query(`DROP TABLE "address"`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "address" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "street" character varying NOT NULL, "city" character varying NOT NULL, "zipCode" character varying(6) NOT NULL, "country" character varying(2) NOT NULL, CONSTRAINT "PK_d92de1f82754668b5f5f5dd4fd5" PRIMARY KEY ("id"))`); | ||
await queryRunner.query(`ALTER TABLE "cooperative" ADD "addressId" uuid NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "customer" ADD "addressId" uuid`); | ||
await queryRunner.query(`ALTER TABLE "cooperative" ADD CONSTRAINT "FK_76076f95b4afaa794ca4a974661" FOREIGN KEY ("addressId") REFERENCES "address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "customer" ADD CONSTRAINT "FK_7697a356e1f4b79ab3819839e95" FOREIGN KEY ("addressId") REFERENCES "address"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); | ||
} | ||
} |
8 changes: 1 addition & 7 deletions
8
server/src/Application/Customer/Command/CreateCustomerCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
import { ICommand } from 'src/Application/ICommand'; | ||
|
||
export class CreateCustomerCommand implements ICommand { | ||
constructor( | ||
public readonly name: string, | ||
public readonly street: string, | ||
public readonly city: string, | ||
public readonly zipCode: string, | ||
public readonly country: string | ||
) {} | ||
constructor(public readonly name: string) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
server/src/Application/Customer/Command/UpdateCustomerCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
import { ICommand } from 'src/Application/ICommand'; | ||
|
||
export class UpdateCustomerCommand implements ICommand { | ||
constructor( | ||
public readonly id: string, | ||
public readonly name: string, | ||
public readonly street: string, | ||
public readonly city: string, | ||
public readonly zipCode: string, | ||
public readonly country: string | ||
) {} | ||
constructor(public readonly id: string, public readonly name: string) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.