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";
interface CheckInAttributes {
id: string;
checkin: Date;
checkout: Date;
clientID: string;
startTime: Date;
estimatedEndTime: Date;
email: string;
firstName: string;
lastName: string;
additionalClients: Array<string>;
boatID: string;
destination: string;
note: string;
}
export interface CheckInAttributesInput
extends Optional<CheckInAttributes, "id"> { }
class CheckIn extends Model<CheckInAttributes, CheckInAttributesInput> implements CheckInAttributes {
declare id: string;
declare checkin: Date;
declare checkout: Date;
declare clientID: string;
declare startTime: Date;
declare estimatedEndTime: Date;
declare email: string;
declare firstName: string;
declare lastName: string;
declare additionalClients: Array<string>;
declare boatID: string;
declare destination: string;
declare note: string;
declare readonly createdAt: Date;
declare readonly updatedAt: Date;
......@@ -35,20 +37,28 @@ export const initCheckIn = async (sequelizeConnection: Sequelize) => {
primaryKey: true,
allowNull: false,
},
checkin: {
startTime: {
type: DataTypes.DATE,
allowNull: false,
},
checkout: {
estimatedEndTime: {
type: DataTypes.DATE,
allowNull: false,
},
clientID: {
type: DataTypes.UUID,
references: {
model: "customer",
key: "id",
},
email: {
type: new DataTypes.STRING(),
allowNull: false,
},
firstName: {
type: new DataTypes.STRING(),
allowNull: false,
},
lastName: {
type: new DataTypes.STRING(),
allowNull: false,
},
additionalClients: {
type: new DataTypes.ARRAY(DataTypes.STRING),
},
boatID: {
type: DataTypes.UUID,
......@@ -57,12 +67,6 @@ export const initCheckIn = async (sequelizeConnection: Sequelize) => {
key: "id",
},
},
destination: {
type: new DataTypes.STRING(),
},
note: {
type: new DataTypes.STRING(),
},
},
{
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