Skip to content
Snippets Groups Projects
Commit 2c007464 authored by elit04's avatar elit04
Browse files

CheckIn+Customer tables merged into CheckIn table in DB

parent 73667db9
No related branches found
No related tags found
No related merge requests found
...@@ -3,24 +3,26 @@ import { DataTypes, Model, Optional , Sequelize} from "sequelize"; ...@@ -3,24 +3,26 @@ import { DataTypes, Model, Optional , Sequelize} from "sequelize";
interface CheckInAttributes { interface CheckInAttributes {
id: string; id: string;
checkin: Date; startTime: Date;
checkout: Date; estimatedEndTime: Date;
clientID: string; email: string;
firstName: string;
lastName: string;
additionalClients: Array<string>;
boatID: string; boatID: string;
destination: string;
note: string;
} }
export interface CheckInAttributesInput export interface CheckInAttributesInput
extends Optional<CheckInAttributes, "id"> { } extends Optional<CheckInAttributes, "id"> { }
class CheckIn extends Model<CheckInAttributes, CheckInAttributesInput> implements CheckInAttributes { class CheckIn extends Model<CheckInAttributes, CheckInAttributesInput> implements CheckInAttributes {
declare id: string; declare id: string;
declare checkin: Date; declare startTime: Date;
declare checkout: Date; declare estimatedEndTime: Date;
declare clientID: string; declare email: string;
declare firstName: string;
declare lastName: string;
declare additionalClients: Array<string>;
declare boatID: string; declare boatID: string;
declare destination: string;
declare note: string;
declare readonly createdAt: Date; declare readonly createdAt: Date;
declare readonly updatedAt: Date; declare readonly updatedAt: Date;
...@@ -35,20 +37,28 @@ export const initCheckIn = async (sequelizeConnection: Sequelize) => { ...@@ -35,20 +37,28 @@ export const initCheckIn = async (sequelizeConnection: Sequelize) => {
primaryKey: true, primaryKey: true,
allowNull: false, allowNull: false,
}, },
checkin: { startTime: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
}, },
checkout: { estimatedEndTime: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
}, },
clientID: { email: {
type: DataTypes.UUID, type: new DataTypes.STRING(),
references: { allowNull: false,
model: "customer", },
key: "id", firstName: {
}, type: new DataTypes.STRING(),
allowNull: false,
},
lastName: {
type: new DataTypes.STRING(),
allowNull: false,
},
additionalClients: {
type: new DataTypes.ARRAY(DataTypes.STRING),
}, },
boatID: { boatID: {
type: DataTypes.UUID, type: DataTypes.UUID,
...@@ -57,12 +67,6 @@ export const initCheckIn = async (sequelizeConnection: Sequelize) => { ...@@ -57,12 +67,6 @@ export const initCheckIn = async (sequelizeConnection: Sequelize) => {
key: "id", key: "id",
}, },
}, },
destination: {
type: new DataTypes.STRING(),
},
note: {
type: new DataTypes.STRING(),
},
}, },
{ {
tableName: "checkin", tableName: "checkin",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment