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 {
@Unique
@Column({
type: DataType.INTEGER,
primaryKey: true,
autoIncrement: true,
field: "id"
@ -18,7 +17,6 @@ export default class Booking extends Model {
@ForeignKey(() => Hotel)
@Column({
type: DataType.INTEGER,
field: "HotelId"
})
hotelId: number;
@ -26,28 +24,11 @@ export default class Booking extends Model {
@BelongsTo(() => Hotel)
hotel: Hotel;
@Column({
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
})
@CreatedAt
createdDate: Date;
@ForeignKey(() => Client)
@Column({
type: DataType.INTEGER,
field: "clientId"
})
clientId: number;

View File

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

View File

@ -17,22 +17,16 @@ export default class Hotel extends Model {
id: number;
@Column({
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
})
@CreatedAt
createdDate: Date;
@HasMany(() => Booking)