Remove redundant code

This commit is contained in:
Alex Piqueras 2024-12-02 10:01:43 +01:00
parent 0140d93b9a
commit b6458d0488
3 changed files with 3 additions and 36 deletions

View File

@ -9,7 +9,6 @@ import Client from "./client.model.ts";
export default class Booking extends Model { export default class Booking extends Model {
@Unique @Unique
@Column({ @Column({
type: DataType.INTEGER,
primaryKey: true, primaryKey: true,
autoIncrement: true, autoIncrement: true,
field: "id" field: "id"
@ -18,7 +17,6 @@ export default class Booking extends Model {
@ForeignKey(() => Hotel) @ForeignKey(() => Hotel)
@Column({ @Column({
type: DataType.INTEGER,
field: "HotelId" field: "HotelId"
}) })
hotelId: number; hotelId: number;
@ -26,28 +24,11 @@ export default class Booking extends Model {
@BelongsTo(() => Hotel) @BelongsTo(() => Hotel)
hotel: Hotel; hotel: Hotel;
@Column({ @CreatedAt
type: DataType.STRING(255),
field: "Name"
})
name?: string;
@Column({
type: DataType.STRING(255),
field: "Address"
})
address?: string;
@Column({
type: DataType.DATE,
field: "CreatedDate"
defaultValue: DataType.NOW
})
createdDate: Date; createdDate: Date;
@ForeignKey(() => Client) @ForeignKey(() => Client)
@Column({ @Column({
type: DataType.INTEGER,
field: "clientId" field: "clientId"
}) })
clientId: number; clientId: number;

View File

@ -9,7 +9,6 @@ import Booking from "./booking.model.ts";
export default class Client extends Model { export default class Client extends Model {
@Unique @Unique
@Column({ @Column({
type: DataType.INTEGER,
primaryKey: true, primaryKey: true,
autoIncrement: true, autoIncrement: true,
field: "id" field: "id"
@ -17,28 +16,21 @@ export default class Client extends Model {
id: number; id: number;
@Column({ @Column({
type: DataType.STRING(255),
field: "Name" field: "Name"
}) })
name: string; name: string;
@Column({ @Column({
type: DataType.STRING(255),
field: "Address" field: "Address"
}) })
address: string; address: string;
@Column({ @Column({
type: DataType.STRING(255),
field: "Phone" field: "Phone"
}) })
phone: string; phone: string;
@Column({ @CreatedAt
type: DataType.DATE,
field: "CreatedDate"
defaultValue: DataType.NOW
})
createdDate: Date; createdDate: Date;
@HasMany(() => Booking) @HasMany(() => Booking)

View File

@ -17,22 +17,16 @@ export default class Hotel extends Model {
id: number; id: number;
@Column({ @Column({
type: DataType.STRING(255),
field: "Name" field: "Name"
}) })
name: string; name: string;
@Column({ @Column({
type: DataType.STRING(255),
field: "Address" field: "Address"
}) })
address: string; address: string;
@Column({ @CreatedAt
type: DataType.DATE,
field: "CreatedDate"
defaultValue: DataType.NOW
})
createdDate: Date; createdDate: Date;
@HasMany(() => Booking) @HasMany(() => Booking)