From b347ab02500b0f6e7c81578f7a3e51253aa60e41 Mon Sep 17 00:00:00 2001 From: ItsMalma Date: Tue, 4 Nov 2025 18:02:28 +0700 Subject: [PATCH] setup database, entities, and migrations --- bun.lock | 111 +- package.json | 8 + src/configs/mikro-orm.config.ts | 19 + src/database/entities/airline.entity.ts | 56 + src/database/entities/airport.entity.ts | 53 + src/database/entities/city.entity.ts | 50 + src/database/entities/country.entity.ts | 40 + src/database/entities/flight-class.entity.ts | 71 + src/database/entities/flight.entity.ts | 75 + .../entities/hotel-facility.entity.ts | 43 + src/database/entities/hotel-image.entity.ts | 34 + src/database/entities/hotel.entity.ts | 96 + .../entities/package-detail.entity.ts | 103 + src/database/entities/package.entity.ts | 56 + .../transportation-class-image.entity.ts | 34 + .../entities/transportation-class.entity.ts | 60 + .../entities/transportation.entity.ts | 46 + src/database/enums/package-class.enum.ts | 5 + src/database/enums/package-type.enum.ts | 4 + src/database/enums/skytrax-type.enum.ts | 4 + .../migrations/.snapshot-goumrah.json | 2257 +++++++++++++++++ .../migrations/Migration20251104110158.ts | 367 +++ src/database/orm.ts | 12 + src/server.ts | 2 + tsconfig.json | 3 + 25 files changed, 3608 insertions(+), 1 deletion(-) create mode 100644 src/configs/mikro-orm.config.ts create mode 100644 src/database/entities/airline.entity.ts create mode 100644 src/database/entities/airport.entity.ts create mode 100644 src/database/entities/city.entity.ts create mode 100644 src/database/entities/country.entity.ts create mode 100644 src/database/entities/flight-class.entity.ts create mode 100644 src/database/entities/flight.entity.ts create mode 100644 src/database/entities/hotel-facility.entity.ts create mode 100644 src/database/entities/hotel-image.entity.ts create mode 100644 src/database/entities/hotel.entity.ts create mode 100644 src/database/entities/package-detail.entity.ts create mode 100644 src/database/entities/package.entity.ts create mode 100644 src/database/entities/transportation-class-image.entity.ts create mode 100644 src/database/entities/transportation-class.entity.ts create mode 100644 src/database/entities/transportation.entity.ts create mode 100644 src/database/enums/package-class.enum.ts create mode 100644 src/database/enums/package-type.enum.ts create mode 100644 src/database/enums/skytrax-type.enum.ts create mode 100644 src/database/migrations/.snapshot-goumrah.json create mode 100644 src/database/migrations/Migration20251104110158.ts create mode 100644 src/database/orm.ts diff --git a/bun.lock b/bun.lock index 186e041..5067228 100644 --- a/bun.lock +++ b/bun.lock @@ -3,12 +3,15 @@ "workspaces": { "": { "dependencies": { + "@mikro-orm/cli": "6.5.9", "@mikro-orm/core": "6.5.9", + "@mikro-orm/migrations": "6.5.9", "@mikro-orm/postgresql": "6.5.9", "compression": "1.8.1", "cors": "2.8.5", "express": "5.1.0", "helmet": "8.1.0", + "reflect-metadata": "0.2.2", "zod": "4.1.12", }, "devDependencies": { @@ -22,10 +25,16 @@ }, }, "packages": { + "@jercle/yargonaut": ["@jercle/yargonaut@1.1.5", "", { "dependencies": { "chalk": "^4.1.2", "figlet": "^1.5.2", "parent-require": "^1.0.0" } }, "sha512-zBp2myVvBHp1UaJsNTyS6q4UDKT7eRiqTS4oNTS6VQMd6mpxYOdbeK4pY279cDCdakGy6hG0J3ejoXZVsPwHqw=="], + + "@mikro-orm/cli": ["@mikro-orm/cli@6.5.9", "", { "dependencies": { "@jercle/yargonaut": "1.1.5", "@mikro-orm/core": "6.5.9", "@mikro-orm/knex": "6.5.9", "fs-extra": "11.3.2", "tsconfig-paths": "4.2.0", "yargs": "17.7.2" }, "bin": { "mikro-orm": "cli", "mikro-orm-esm": "esm" } }, "sha512-Jihukq7STU5ZfRdjOBSR7mzOClqkhkic7t8GF/OAoMBeHgpUc93Ug2GvSMrJaNWGg4AKtgch/cP/KGv/3QtSsQ=="], + "@mikro-orm/core": ["@mikro-orm/core@6.5.9", "", { "dependencies": { "dataloader": "2.2.3", "dotenv": "17.2.3", "esprima": "4.0.1", "fs-extra": "11.3.2", "globby": "11.1.0", "mikro-orm": "6.5.9", "reflect-metadata": "0.2.2" } }, "sha512-BDfMW35pKVfSBBK0TiIpjh+IX62UwD0V22x4O6psMfiwbFoAJN/gEpEg1FuLx41dYf/ExHe9Cin6U6hwRdELaQ=="], "@mikro-orm/knex": ["@mikro-orm/knex@6.5.9", "", { "dependencies": { "fs-extra": "11.3.2", "knex": "3.1.0", "sqlstring": "2.3.3" }, "peerDependencies": { "@mikro-orm/core": "^6.0.0", "better-sqlite3": "*", "libsql": "*", "mariadb": "*" }, "optionalPeers": ["better-sqlite3", "libsql", "mariadb"] }, "sha512-VtBPIcNYyWeQ+M+ha5DD+961gc6jtJDX0JLkBfMatTgHl78R1IuiTPaPfen4X9ezEDsR6N8XqJtuRmOXRFl6lA=="], + "@mikro-orm/migrations": ["@mikro-orm/migrations@6.5.9", "", { "dependencies": { "@mikro-orm/knex": "6.5.9", "fs-extra": "11.3.2", "umzug": "3.8.2" }, "peerDependencies": { "@mikro-orm/core": "^6.0.0" } }, "sha512-gDIcmG1ix9PmFCXwQFmrzpttG7AEqV64irSzzPLZqaRQGzahbhYz56vY/q4in7Nf5gpMCgzEuNtpMmCcoEfjfw=="], + "@mikro-orm/postgresql": ["@mikro-orm/postgresql@6.5.9", "", { "dependencies": { "@mikro-orm/knex": "6.5.9", "pg": "8.16.3", "postgres-array": "3.0.4", "postgres-date": "2.1.0", "postgres-interval": "4.0.2" }, "peerDependencies": { "@mikro-orm/core": "^6.0.0" } }, "sha512-0pIWgHolYzAHa2/0fXjDNzGYK833XNHCuH079c65gScCl1s+YuByXPW7rJIYMqVXsgWtWpuS43G0VJ+jglXPQg=="], "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], @@ -34,6 +43,14 @@ "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], + "@rushstack/node-core-library": ["@rushstack/node-core-library@5.13.0", "", { "dependencies": { "ajv": "~8.13.0", "ajv-draft-04": "~1.0.0", "ajv-formats": "~3.0.1", "fs-extra": "~11.3.0", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.22.1", "semver": "~7.5.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-IGVhy+JgUacAdCGXKUrRhwHMTzqhWwZUI+qEPcdzsb80heOw0QPbhhoVsoiMF7Klp8eYsp7hzpScMXmOa3Uhfg=="], + + "@rushstack/terminal": ["@rushstack/terminal@0.15.2", "", { "dependencies": { "@rushstack/node-core-library": "5.13.0", "supports-color": "~8.1.1" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-7Hmc0ysK5077R/IkLS9hYu0QuNafm+TbZbtYVzCMbeOdMjaRboLKrhryjwZSRJGJzu+TV1ON7qZHeqf58XfLpA=="], + + "@rushstack/ts-command-line": ["@rushstack/ts-command-line@4.23.7", "", { "dependencies": { "@rushstack/terminal": "0.15.2", "@types/argparse": "1.0.38", "argparse": "~1.0.9", "string-argv": "~0.3.1" } }, "sha512-Gr9cB7DGe6uz5vq2wdr89WbVDKz0UeuFEn5H2CfWDe7JvjFFaiV15gi6mqDBTbHhHCWS7w8mF1h3BnIfUndqdA=="], + + "@types/argparse": ["@types/argparse@1.0.38", "", {}, "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA=="], + "@types/body-parser": ["@types/body-parser@1.19.6", "", { "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g=="], "@types/bun": ["@types/bun@1.3.1", "", { "dependencies": { "bun-types": "1.3.1" } }, "sha512-4jNMk2/K9YJtfqwoAa28c8wK+T7nvJFOjxI4h/7sORWcypRNxBpr+TPNaCfVWq70tLCJsqoFwcf0oI0JU/fvMQ=="], @@ -66,6 +83,18 @@ "accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="], + "ajv": ["ajv@8.13.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.4.1" } }, "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA=="], + + "ajv-draft-04": ["ajv-draft-04@1.0.0", "", { "peerDependencies": { "ajv": "^8.5.0" }, "optionalPeers": ["ajv"] }, "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw=="], + + "ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="], + + "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + + "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + + "argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], + "array-union": ["array-union@2.1.0", "", {}, "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw=="], "body-parser": ["body-parser@2.2.0", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.0", "http-errors": "^2.0.0", "iconv-lite": "^0.6.3", "on-finished": "^2.4.1", "qs": "^6.14.0", "raw-body": "^3.0.0", "type-is": "^2.0.0" } }, "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg=="], @@ -80,9 +109,17 @@ "call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="], + "chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + + "cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="], + + "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], + + "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], + "colorette": ["colorette@2.0.19", "", {}, "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ=="], - "commander": ["commander@10.0.1", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="], + "commander": ["commander@14.0.2", "", {}, "sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ=="], "compressible": ["compressible@2.0.18", "", { "dependencies": { "mime-db": ">= 1.43.0 < 2" } }, "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg=="], @@ -114,6 +151,10 @@ "ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="], + "emittery": ["emittery@0.13.1", "", {}, "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ=="], + + "emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], + "encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="], "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="], @@ -134,10 +175,14 @@ "express": ["express@5.1.0", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.0", "content-disposition": "^1.0.0", "content-type": "^1.0.5", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.7", "qs": "^6.14.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.0.1", "vary": "^1.1.2" } }, "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA=="], + "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], + "fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="], "fastq": ["fastq@1.19.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ=="], + "figlet": ["figlet@1.9.3", "", { "dependencies": { "commander": "^14.0.0" }, "bin": { "figlet": "bin/index.js" } }, "sha512-majPgOpVtrZN1iyNGbsUP6bOtZ6eaJgg5HHh0vFvm5DJhh8dc+FJpOC4GABvMZ/A7XHAJUuJujhgUY/2jPWgMA=="], + "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="], "finalhandler": ["finalhandler@2.1.0", "", { "dependencies": { "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "on-finished": "^2.4.1", "parseurl": "^1.3.3", "statuses": "^2.0.1" } }, "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q=="], @@ -150,6 +195,8 @@ "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="], + "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], + "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="], "get-package-type": ["get-package-type@0.1.0", "", {}, "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q=="], @@ -166,6 +213,8 @@ "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], + "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="], "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="], @@ -178,6 +227,8 @@ "ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], + "import-lazy": ["import-lazy@4.0.0", "", {}, "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw=="], + "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="], "interpret": ["interpret@2.2.0", "", {}, "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw=="], @@ -188,18 +239,28 @@ "is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="], + "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="], + "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], "is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="], "is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="], + "jju": ["jju@1.4.0", "", {}, "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA=="], + + "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + + "json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], + "jsonfile": ["jsonfile@6.2.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg=="], "knex": ["knex@3.1.0", "", { "dependencies": { "colorette": "2.0.19", "commander": "^10.0.0", "debug": "4.3.4", "escalade": "^3.1.1", "esm": "^3.2.25", "get-package-type": "^0.1.0", "getopts": "2.3.0", "interpret": "^2.2.0", "lodash": "^4.17.21", "pg-connection-string": "2.6.2", "rechoir": "^0.8.0", "resolve-from": "^5.0.0", "tarn": "^3.0.2", "tildify": "2.0.0" }, "bin": { "knex": "bin/cli.js" } }, "sha512-GLoII6hR0c4ti243gMs5/1Rb3B+AjwMOfjYm97pu0FOQa7JH56hgBxYf5WK2525ceSbBY1cjeZ9yk99GPMB6Kw=="], "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], + "lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], + "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], "media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="], @@ -216,6 +277,8 @@ "mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="], + "minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], + "ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="], "negotiator": ["negotiator@0.6.4", "", {}, "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w=="], @@ -230,6 +293,8 @@ "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="], + "parent-require": ["parent-require@1.0.0", "", {}, "sha512-2MXDNZC4aXdkkap+rBBMv0lUsfJqvX5/2FiYYnfCnorZt3Pk06/IOR5KeaoghgS2w07MLWgjbsnyaq6PdHn2LQ=="], + "parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="], "path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="], @@ -256,6 +321,8 @@ "picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "pony-cause": ["pony-cause@2.1.11", "", {}, "sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg=="], + "postgres-array": ["postgres-array@3.0.4", "", {}, "sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ=="], "postgres-bytea": ["postgres-bytea@1.0.0", "", {}, "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w=="], @@ -268,6 +335,8 @@ "proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="], + "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], + "qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="], "queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="], @@ -280,6 +349,10 @@ "reflect-metadata": ["reflect-metadata@0.2.2", "", {}, "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q=="], + "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="], + + "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], + "resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], "resolve-from": ["resolve-from@5.0.0", "", {}, "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw=="], @@ -294,6 +367,8 @@ "safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="], + "semver": ["semver@7.5.4", "", { "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" } }, "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA=="], + "send": ["send@1.2.0", "", { "dependencies": { "debug": "^4.3.5", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "fresh": "^2.0.0", "http-errors": "^2.0.0", "mime-types": "^3.0.1", "ms": "^2.1.3", "on-finished": "^2.4.1", "range-parser": "^1.2.1", "statuses": "^2.0.1" } }, "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw=="], "serve-static": ["serve-static@2.2.0", "", { "dependencies": { "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "parseurl": "^1.3.3", "send": "^1.2.0" } }, "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ=="], @@ -312,10 +387,22 @@ "split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="], + "sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="], + "sqlstring": ["sqlstring@2.3.3", "", {}, "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg=="], "statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="], + "string-argv": ["string-argv@0.3.2", "", {}, "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q=="], + + "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + + "strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + + "strip-bom": ["strip-bom@3.0.0", "", {}, "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA=="], + + "supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="], "tarn": ["tarn@3.0.2", "", {}, "sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ=="], @@ -326,24 +413,44 @@ "toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="], + "tsconfig-paths": ["tsconfig-paths@4.2.0", "", { "dependencies": { "json5": "^2.2.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg=="], + + "type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="], + "type-is": ["type-is@2.0.1", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="], "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "umzug": ["umzug@3.8.2", "", { "dependencies": { "@rushstack/ts-command-line": "^4.12.2", "emittery": "^0.13.0", "fast-glob": "^3.3.2", "pony-cause": "^2.1.4", "type-fest": "^4.0.0" } }, "sha512-BEWEF8OJjTYVC56GjELeHl/1XjFejrD7aHzn+HldRJTx+pL1siBrKHZC8n4K/xL3bEzVA9o++qD1tK2CpZu4KA=="], + "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], "universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], "unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="], + "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], + "vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="], + "wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], + "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="], "xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], + "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="], + + "yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], + + "yargs": ["yargs@17.7.2", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="], + + "yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="], + "zod": ["zod@4.1.12", "", {}, "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ=="], + "@rushstack/terminal/supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], + "accepts/negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="], "body-parser/debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], @@ -354,6 +461,8 @@ "http-errors/statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="], + "knex/commander": ["commander@10.0.1", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="], + "knex/debug": ["debug@4.3.4", "", { "dependencies": { "ms": "2.1.2" } }, "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ=="], "knex/pg-connection-string": ["pg-connection-string@2.6.2", "", {}, "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA=="], diff --git a/package.json b/package.json index fb943a3..0e57325 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,21 @@ "scripts": { "dev": "bun run src/server.ts" }, + "mikro-orm": { + "configPaths": [ + "src/configs/mikro-orm.config.ts" + ] + }, "dependencies": { + "@mikro-orm/cli": "6.5.9", "@mikro-orm/core": "6.5.9", + "@mikro-orm/migrations": "6.5.9", "@mikro-orm/postgresql": "6.5.9", "compression": "1.8.1", "cors": "2.8.5", "express": "5.1.0", "helmet": "8.1.0", + "reflect-metadata": "0.2.2", "zod": "4.1.12" }, "devDependencies": { diff --git a/src/configs/mikro-orm.config.ts b/src/configs/mikro-orm.config.ts new file mode 100644 index 0000000..08159e7 --- /dev/null +++ b/src/configs/mikro-orm.config.ts @@ -0,0 +1,19 @@ +import { databaseConfig } from "@/configs/database.config"; +import { Migrator } from "@mikro-orm/migrations"; +import { defineConfig } from "@mikro-orm/postgresql"; + +export default defineConfig({ + host: databaseConfig.host, + port: databaseConfig.port, + user: databaseConfig.username, + password: databaseConfig.password, + dbName: databaseConfig.name, + entities: ["src/database/entities/*.entity.ts"], + entitiesTs: ["src/database/entities/*.entity.ts"], + extensions: [Migrator], + migrations: { + tableName: "_migrations", + path: "src/database/migrations", + pathTs: "src/database/migrations", + }, +}); diff --git a/src/database/entities/airline.entity.ts b/src/database/entities/airline.entity.ts new file mode 100644 index 0000000..9200ff8 --- /dev/null +++ b/src/database/entities/airline.entity.ts @@ -0,0 +1,56 @@ +import { Flight } from "@/database/entities/flight.entity"; +import { SkytraxType } from "@/database/enums/skytrax-type.enum"; +import { + Collection, + Entity, + Enum, + OneToMany, + PrimaryKey, + Property, + Unique, +} from "@mikro-orm/core"; + +@Entity() +export class Airline { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 10 }) + @Unique() + code!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @Property({ type: "varchar", length: 100 }) + @Unique() + logo!: string; + + @Property({ type: "int", nullable: true }) + skytraxRating!: number; + + @Enum(() => SkytraxType) + skytraxType!: SkytraxType; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany(() => Flight, (flight) => flight.airline) + flights = new Collection(this); +} diff --git a/src/database/entities/airport.entity.ts b/src/database/entities/airport.entity.ts new file mode 100644 index 0000000..24715d1 --- /dev/null +++ b/src/database/entities/airport.entity.ts @@ -0,0 +1,53 @@ +import { City } from "@/database/entities/city.entity"; +import { Flight } from "@/database/entities/flight.entity"; +import { + Collection, + Entity, + ManyToOne, + OneToMany, + PrimaryKey, + Property, + type Rel, + Unique, +} from "@mikro-orm/core"; + +@Entity() +export class Airport { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 10 }) + @Unique() + code!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @ManyToOne(() => City) + city!: Rel; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany(() => Flight, (flight) => flight.departureAirport) + departureFlights = new Collection(this); + + @OneToMany(() => Flight, (flight) => flight.arrivalAirport) + arrivalFlights = new Collection(this); +} diff --git a/src/database/entities/city.entity.ts b/src/database/entities/city.entity.ts new file mode 100644 index 0000000..f9f842e --- /dev/null +++ b/src/database/entities/city.entity.ts @@ -0,0 +1,50 @@ +import { Airport } from "@/database/entities/airport.entity"; +import { Country } from "@/database/entities/country.entity"; +import { Hotel } from "@/database/entities/hotel.entity"; +import { + Collection, + Entity, + ManyToOne, + OneToMany, + PrimaryKey, + Property, + Unique, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +export class City { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @ManyToOne(() => Country) + country!: Rel; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany(() => Airport, (airport) => airport.city) + cities = new Collection(this); + + @OneToMany(() => Hotel, (hotel) => hotel.city) + hotels = new Collection(this); +} diff --git a/src/database/entities/country.entity.ts b/src/database/entities/country.entity.ts new file mode 100644 index 0000000..700789a --- /dev/null +++ b/src/database/entities/country.entity.ts @@ -0,0 +1,40 @@ +import { City } from "@/database/entities/city.entity"; +import { + Collection, + Entity, + OneToMany, + PrimaryKey, + Property, + Unique, +} from "@mikro-orm/core"; + +@Entity() +export class Country { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany(() => City, (city) => city.country) + cities = new Collection(this); +} diff --git a/src/database/entities/flight-class.entity.ts b/src/database/entities/flight-class.entity.ts new file mode 100644 index 0000000..298351f --- /dev/null +++ b/src/database/entities/flight-class.entity.ts @@ -0,0 +1,71 @@ +import { Flight } from "@/database/entities/flight.entity"; +import { PackageDetail } from "@/database/entities/package-detail.entity"; +import { + Collection, + Entity, + ManyToMany, + ManyToOne, + PrimaryKey, + Property, + Unique, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +@Unique({ properties: ["flight", "class"] }) +export class FlightClass { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 420 }) + @Unique() + slug!: string; + + @ManyToOne(() => Flight) + flight!: Rel; + + @Property({ type: "varchar", length: 100 }) + class!: string; + + @Property({ type: "varchar", length: 10 }) + seatLayout!: string; + + @Property({ type: "integer", unsigned: true }) + baggage!: number; + + @Property({ type: "integer", unsigned: true }) + cabinBaggage!: number; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @ManyToMany( + () => PackageDetail, + (packageDetail) => packageDetail.tourFlightClasses, + ) + tourPackageDetails = new Collection(this); + + @ManyToMany( + () => PackageDetail, + (packageDetail) => packageDetail.outboundFlightClasses, + ) + outboundPackageDetails = new Collection(this); + + @ManyToMany( + () => PackageDetail, + (packageDetail) => packageDetail.inboundFlightClasses, + ) + inboundPackageDetails = new Collection(this); +} diff --git a/src/database/entities/flight.entity.ts b/src/database/entities/flight.entity.ts new file mode 100644 index 0000000..75b126c --- /dev/null +++ b/src/database/entities/flight.entity.ts @@ -0,0 +1,75 @@ +import { Airline } from "@/database/entities/airline.entity"; +import { Airport } from "@/database/entities/airport.entity"; +import { FlightClass } from "@/database/entities/flight-class.entity"; +import { + Collection, + Entity, + ManyToOne, + OneToMany, + PrimaryKey, + Property, + Unique, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +@Unique({ properties: ["airline", "number"] }) +export class Flight { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 220 }) + @Unique() + slug!: string; + + @ManyToOne(() => Airline) + airline!: Rel; + + @Property({ type: "integer", unsigned: true }) + number!: number; + + @ManyToOne(() => Airport) + departureAirport!: Rel; + + @Property({ type: "varchar", length: 100, nullable: true }) + departureTerminal?: string; + + @Property({ type: "varchar", length: 100, nullable: true }) + departureGate?: string; + + @Property({ type: "time" }) + departureTime!: string; + + @ManyToOne(() => Airport) + arrivalAirport!: Rel; + + @Property({ type: "varchar", length: 100, nullable: true }) + arrivalTerminal?: string; + + @Property({ type: "varchar", length: 100, nullable: true }) + arrivalGate?: string; + + @Property({ type: "integer", unsigned: true }) + duration!: number; + + @Property({ type: "varchar", length: 100 }) + aircraft!: string; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany(() => FlightClass, (flightClass) => flightClass.flight) + classes = new Collection(this); +} diff --git a/src/database/entities/hotel-facility.entity.ts b/src/database/entities/hotel-facility.entity.ts new file mode 100644 index 0000000..afb39b4 --- /dev/null +++ b/src/database/entities/hotel-facility.entity.ts @@ -0,0 +1,43 @@ +import { Hotel } from "@/database/entities/hotel.entity"; +import { + Collection, + Entity, + ManyToMany, + PrimaryKey, + Property, + Unique, +} from "@mikro-orm/core"; + +@Entity() +export class HotelFacility { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @Property({ type: "varchar", length: 100 }) + icon!: string; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @ManyToMany(() => Hotel, (hotel) => hotel.facilities) + hotels = new Collection(this); +} diff --git a/src/database/entities/hotel-image.entity.ts b/src/database/entities/hotel-image.entity.ts new file mode 100644 index 0000000..b508158 --- /dev/null +++ b/src/database/entities/hotel-image.entity.ts @@ -0,0 +1,34 @@ +import { Hotel } from "@/database/entities/hotel.entity"; +import { + Entity, + ManyToOne, + PrimaryKey, + Property, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +export class HotelImage { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @ManyToOne(() => Hotel) + hotel!: Rel; + + @Property({ type: "varchar", length: 100 }) + src!: string; + + @Property({ type: "varchar", length: 100 }) + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; +} diff --git a/src/database/entities/hotel.entity.ts b/src/database/entities/hotel.entity.ts new file mode 100644 index 0000000..adbb049 --- /dev/null +++ b/src/database/entities/hotel.entity.ts @@ -0,0 +1,96 @@ +import { City } from "@/database/entities/city.entity"; +import { HotelFacility } from "@/database/entities/hotel-facility.entity"; +import { HotelImage } from "@/database/entities/hotel-image.entity"; +import { PackageDetail } from "@/database/entities/package-detail.entity"; +import { + Collection, + Entity, + ManyToMany, + ManyToOne, + OneToMany, + PrimaryKey, + Property, + Unique, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +export class Hotel { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @ManyToOne(() => City) + city!: Rel; + + @Property({ type: "integer", unsigned: true }) + star!: number; + + @Property({ type: "varchar", length: 500 }) + googleMapsLink!: string; + + @Property({ type: "varchar", length: 500 }) + googleMapsEmbed!: string; + + @Property({ type: "varchar", length: 500 }) + googleReviewsLink!: string; + + @Property({ type: "varchar", length: 1000 }) + description!: string; + + @Property({ type: "varchar", length: 100 }) + address!: string; + + @Property({ type: "varchar", length: 100 }) + landmark!: string; + + @Property({ type: "decimal" }) + distanceToLandmark!: string; + + @Property({ type: "varchar", length: 100 }) + foodType!: string; + + @Property({ type: "integer", unsigned: true }) + foodAmount!: string; + + @Property({ type: "varchar", length: 100 }) + foodMenu!: string; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany(() => HotelImage, (hotelImage) => hotelImage.hotel) + images = new Collection(this); + + @ManyToMany(() => HotelFacility, (hotelFacility) => hotelFacility.hotels, { + owner: true, + }) + facilities = new Collection(this); + + @ManyToMany(() => PackageDetail, (packageDetail) => packageDetail.tourHotels) + tourPackageDetails = new Collection(this); + + @OneToMany(() => PackageDetail, (packageDetail) => packageDetail.makkahHotel) + makkahPackageDetails = new Collection(this); + + @OneToMany(() => PackageDetail, (packageDetail) => packageDetail.madinahHotel) + madinahPackageDetails = new Collection(this); +} diff --git a/src/database/entities/package-detail.entity.ts b/src/database/entities/package-detail.entity.ts new file mode 100644 index 0000000..8b95016 --- /dev/null +++ b/src/database/entities/package-detail.entity.ts @@ -0,0 +1,103 @@ +import { FlightClass } from "@/database/entities/flight-class.entity"; +import { Hotel } from "@/database/entities/hotel.entity"; +import { Package } from "@/database/entities/package.entity"; +import { TransportationClass } from "@/database/entities/transportation-class.entity"; +import { + Collection, + Entity, + ManyToMany, + ManyToOne, + PrimaryKey, + Property, + Unique, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +@Unique({ properties: ["package", "departureDate"] }) +export class PackageDetail { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @ManyToOne(() => Package) + package!: Rel; + + @Property({ type: "date" }) + departureDate!: Date; + + @ManyToOne(() => Hotel) + makkahHotel!: Rel; + + @ManyToOne(() => Hotel) + madinahHotel!: Rel; + + @ManyToOne(() => TransportationClass) + transportation!: Rel; + + @Property({ type: "decimal", unsigned: true }) + quadPrice!: number; + + @Property({ type: "decimal", unsigned: true }) + triplePrice!: number; + + @Property({ type: "decimal", unsigned: true }) + doublePrice!: number; + + @Property({ type: "decimal", nullable: true, unsigned: true }) + infantPrice?: number; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @ManyToMany( + () => FlightClass, + (flightClass) => flightClass.tourPackageDetails, + { + owner: true, + fixedOrder: true, + }, + ) + tourFlightClasses = new Collection(this); + + @ManyToMany( + () => FlightClass, + (flightClass) => flightClass.outboundPackageDetails, + { + owner: true, + fixedOrder: true, + }, + ) + outboundFlightClasses = new Collection(this); + + @ManyToMany( + () => FlightClass, + (flightClass) => flightClass.inboundPackageDetails, + { + owner: true, + fixedOrder: true, + }, + ) + inboundFlightClasses = new Collection(this); + + @ManyToMany(() => Hotel, (hotel) => hotel.tourPackageDetails, { + owner: true, + fixedOrder: true, + }) + tourHotels = new Collection(this); +} diff --git a/src/database/entities/package.entity.ts b/src/database/entities/package.entity.ts new file mode 100644 index 0000000..11ec27f --- /dev/null +++ b/src/database/entities/package.entity.ts @@ -0,0 +1,56 @@ +import { PackageDetail } from "@/database/entities/package-detail.entity"; +import { PackageClass } from "@/database/enums/package-class.enum"; +import { PackageType } from "@/database/enums/package-type.enum"; +import { + Collection, + Entity, + Enum, + OneToMany, + PrimaryKey, + Property, + Unique, +} from "@mikro-orm/core"; + +@Entity() +export class Package { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 200 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @Enum(() => PackageType) + type!: PackageType; + + @Enum(() => PackageClass) + class!: PackageClass; + + @Property({ type: "varchar", length: 100 }) + @Unique() + thumbnail!: string; + + @Property({ type: "boolean" }) + useFastTrain!: boolean; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany(() => PackageDetail, (packageDetail) => packageDetail.package) + details = new Collection(this); +} diff --git a/src/database/entities/transportation-class-image.entity.ts b/src/database/entities/transportation-class-image.entity.ts new file mode 100644 index 0000000..a0199ab --- /dev/null +++ b/src/database/entities/transportation-class-image.entity.ts @@ -0,0 +1,34 @@ +import { TransportationClass } from "@/database/entities/transportation-class.entity"; +import { + Entity, + ManyToOne, + PrimaryKey, + Property, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +export class TransportationClassImage { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @ManyToOne(() => TransportationClass) + transportationClass!: Rel; + + @Property({ type: "varchar", length: 100 }) + src!: string; + + @Property({ type: "varchar", length: 100 }) + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; +} diff --git a/src/database/entities/transportation-class.entity.ts b/src/database/entities/transportation-class.entity.ts new file mode 100644 index 0000000..7fd6498 --- /dev/null +++ b/src/database/entities/transportation-class.entity.ts @@ -0,0 +1,60 @@ +import { PackageDetail } from "@/database/entities/package-detail.entity"; +import { TransportationClassImage } from "@/database/entities/transportation-class-image.entity"; +import { Transportation } from "@/database/entities/transportation.entity"; +import { + Collection, + Entity, + ManyToOne, + OneToMany, + PrimaryKey, + Property, + Unique, + type Rel, +} from "@mikro-orm/core"; + +@Entity() +@Unique({ properties: ["transportation", "class"] }) +export class TransportationClass { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 400 }) + @Unique() + slug!: string; + + @ManyToOne(() => Transportation) + transportation!: Rel; + + @Property({ type: "varchar", length: 100 }) + class!: string; + + @Property({ type: "integer", unsigned: true }) + totalSeats!: number; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany( + () => TransportationClassImage, + (transportationClassImage) => transportationClassImage.transportationClass, + ) + images = new Collection(this); + + @OneToMany( + () => PackageDetail, + (packageDetail) => packageDetail.transportation, + ) + packageDetails = new Collection(this); +} diff --git a/src/database/entities/transportation.entity.ts b/src/database/entities/transportation.entity.ts new file mode 100644 index 0000000..06b35bd --- /dev/null +++ b/src/database/entities/transportation.entity.ts @@ -0,0 +1,46 @@ +import { TransportationClass } from "@/database/entities/transportation-class.entity"; +import { + Collection, + Entity, + OneToMany, + PrimaryKey, + Property, + Unique, +} from "@mikro-orm/core"; + +@Entity() +export class Transportation { + @PrimaryKey({ type: "varchar", length: 30 }) + id!: string; + + @Property({ type: "varchar", length: 100 }) + @Unique() + slug!: string; + + @Property({ type: "varchar", length: 100 }) + name!: string; + + @Property({ type: "varchar", length: 100 }) + type!: string; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + }) + createdAt!: Date; + + @Property({ + type: "timestamp", + onCreate: () => new Date(), + onUpdate: () => new Date(), + }) + updatedAt!: Date; + + // Collections + + @OneToMany( + () => TransportationClass, + (transportationClass) => transportationClass.transportation, + ) + transportationClasses = new Collection(this); +} diff --git a/src/database/enums/package-class.enum.ts b/src/database/enums/package-class.enum.ts new file mode 100644 index 0000000..7c36f80 --- /dev/null +++ b/src/database/enums/package-class.enum.ts @@ -0,0 +1,5 @@ +export enum PackageClass { + silver = "silver", + gold = "gold", + platinum = "platinum", +} diff --git a/src/database/enums/package-type.enum.ts b/src/database/enums/package-type.enum.ts new file mode 100644 index 0000000..1d2bb49 --- /dev/null +++ b/src/database/enums/package-type.enum.ts @@ -0,0 +1,4 @@ +export enum PackageType { + reguler = "reguler", + plus = "plus", +} diff --git a/src/database/enums/skytrax-type.enum.ts b/src/database/enums/skytrax-type.enum.ts new file mode 100644 index 0000000..eb61004 --- /dev/null +++ b/src/database/enums/skytrax-type.enum.ts @@ -0,0 +1,4 @@ +export enum SkytraxType { + fullService = "full_service", + lowCost = "low_cost", +} diff --git a/src/database/migrations/.snapshot-goumrah.json b/src/database/migrations/.snapshot-goumrah.json new file mode 100644 index 0000000..bc2b803 --- /dev/null +++ b/src/database/migrations/.snapshot-goumrah.json @@ -0,0 +1,2257 @@ +{ + "namespaces": [ + "public" + ], + "name": "public", + "tables": [ + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "code": { + "name": "code", + "type": "varchar(10)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 10, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "logo": { + "name": "logo", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "skytrax_rating": { + "name": "skytrax_rating", + "type": "int", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "integer" + }, + "skytrax_type": { + "name": "skytrax_type", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "full_service", + "low_cost" + ], + "mappedType": "enum" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "airline", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "code" + ], + "composite": false, + "keyName": "airline_code_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "airline_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "columnNames": [ + "logo" + ], + "composite": false, + "keyName": "airline_logo_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "airline_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": {}, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "country", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "country_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "country_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": {}, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "country_id": { + "name": "country_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "city", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "city_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "city_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "city_country_id_foreign": { + "constraintName": "city_country_id_foreign", + "columnNames": [ + "country_id" + ], + "localTableName": "public.city", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.country", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "code": { + "name": "code", + "type": "varchar(10)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 10, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "city_id": { + "name": "city_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "airport", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "code" + ], + "composite": false, + "keyName": "airport_code_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "airport_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "airport_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "airport_city_id_foreign": { + "constraintName": "airport_city_id_foreign", + "columnNames": [ + "city_id" + ], + "localTableName": "public.airport", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.city", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(220)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 220, + "mappedType": "string" + }, + "airline_id": { + "name": "airline_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "number": { + "name": "number", + "type": "int", + "unsigned": true, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "departure_airport_id": { + "name": "departure_airport_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "departure_terminal": { + "name": "departure_terminal", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 100, + "mappedType": "string" + }, + "departure_gate": { + "name": "departure_gate", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 100, + "mappedType": "string" + }, + "departure_time": { + "name": "departure_time", + "type": "time(0)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 0, + "mappedType": "time" + }, + "arrival_airport_id": { + "name": "arrival_airport_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "arrival_terminal": { + "name": "arrival_terminal", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 100, + "mappedType": "string" + }, + "arrival_gate": { + "name": "arrival_gate", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 100, + "mappedType": "string" + }, + "duration": { + "name": "duration", + "type": "int", + "unsigned": true, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "aircraft": { + "name": "aircraft", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "flight", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "flight_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "flight_airline_id_number_unique", + "columnNames": [ + "airline_id", + "number" + ], + "composite": true, + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "flight_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "flight_airline_id_foreign": { + "constraintName": "flight_airline_id_foreign", + "columnNames": [ + "airline_id" + ], + "localTableName": "public.flight", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.airline", + "updateRule": "cascade" + }, + "flight_departure_airport_id_foreign": { + "constraintName": "flight_departure_airport_id_foreign", + "columnNames": [ + "departure_airport_id" + ], + "localTableName": "public.flight", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.airport", + "updateRule": "cascade" + }, + "flight_arrival_airport_id_foreign": { + "constraintName": "flight_arrival_airport_id_foreign", + "columnNames": [ + "arrival_airport_id" + ], + "localTableName": "public.flight", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.airport", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(420)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 420, + "mappedType": "string" + }, + "flight_id": { + "name": "flight_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "class": { + "name": "class", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "seat_layout": { + "name": "seat_layout", + "type": "varchar(10)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 10, + "mappedType": "string" + }, + "baggage": { + "name": "baggage", + "type": "int", + "unsigned": true, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "cabin_baggage": { + "name": "cabin_baggage", + "type": "int", + "unsigned": true, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "flight_class", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "flight_class_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "flight_class_flight_id_class_unique", + "columnNames": [ + "flight_id", + "class" + ], + "composite": true, + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "flight_class_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "flight_class_flight_id_foreign": { + "constraintName": "flight_class_flight_id_foreign", + "columnNames": [ + "flight_id" + ], + "localTableName": "public.flight_class", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.flight", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "city_id": { + "name": "city_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "star": { + "name": "star", + "type": "int", + "unsigned": true, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "google_maps_link": { + "name": "google_maps_link", + "type": "varchar(500)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 500, + "mappedType": "string" + }, + "google_maps_embed": { + "name": "google_maps_embed", + "type": "varchar(500)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 500, + "mappedType": "string" + }, + "google_reviews_link": { + "name": "google_reviews_link", + "type": "varchar(500)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 500, + "mappedType": "string" + }, + "description": { + "name": "description", + "type": "varchar(1000)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 1000, + "mappedType": "string" + }, + "address": { + "name": "address", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "landmark": { + "name": "landmark", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "distance_to_landmark": { + "name": "distance_to_landmark", + "type": "numeric(10,0)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "precision": 10, + "scale": 0, + "mappedType": "decimal" + }, + "food_type": { + "name": "food_type", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "food_amount": { + "name": "food_amount", + "type": "int", + "unsigned": true, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "food_menu": { + "name": "food_menu", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "hotel", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "hotel_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "hotel_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "hotel_city_id_foreign": { + "constraintName": "hotel_city_id_foreign", + "columnNames": [ + "city_id" + ], + "localTableName": "public.hotel", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.city", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "icon": { + "name": "icon", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "hotel_facility", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "hotel_facility_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "hotel_facility_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": {}, + "nativeEnums": {} + }, + { + "columns": { + "hotel_id": { + "name": "hotel_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "hotel_facility_id": { + "name": "hotel_facility_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + } + }, + "name": "hotel_facilities", + "schema": "public", + "indexes": [ + { + "keyName": "hotel_facilities_pkey", + "columnNames": [ + "hotel_id", + "hotel_facility_id" + ], + "composite": true, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "hotel_facilities_hotel_id_foreign": { + "constraintName": "hotel_facilities_hotel_id_foreign", + "columnNames": [ + "hotel_id" + ], + "localTableName": "public.hotel_facilities", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.hotel", + "deleteRule": "cascade", + "updateRule": "cascade" + }, + "hotel_facilities_hotel_facility_id_foreign": { + "constraintName": "hotel_facilities_hotel_facility_id_foreign", + "columnNames": [ + "hotel_facility_id" + ], + "localTableName": "public.hotel_facilities", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.hotel_facility", + "deleteRule": "cascade", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "hotel_id": { + "name": "hotel_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "src": { + "name": "src", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "hotel_image", + "schema": "public", + "indexes": [ + { + "keyName": "hotel_image_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "hotel_image_hotel_id_foreign": { + "constraintName": "hotel_image_hotel_id_foreign", + "columnNames": [ + "hotel_id" + ], + "localTableName": "public.hotel_image", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.hotel", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "type": { + "name": "type", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "reguler", + "plus" + ], + "mappedType": "enum" + }, + "class": { + "name": "class", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "silver", + "gold", + "platinum" + ], + "mappedType": "enum" + }, + "thumbnail": { + "name": "thumbnail", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "use_fast_train": { + "name": "use_fast_train", + "type": "boolean", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "boolean" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "package", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "package_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "columnNames": [ + "thumbnail" + ], + "composite": false, + "keyName": "package_thumbnail_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "package_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": {}, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "name": { + "name": "name", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "type": { + "name": "type", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "transportation", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "transportation_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "transportation_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": {}, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(400)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 400, + "mappedType": "string" + }, + "transportation_id": { + "name": "transportation_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "class": { + "name": "class", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "total_seats": { + "name": "total_seats", + "type": "int", + "unsigned": true, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "transportation_class", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "transportation_class_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "transportation_class_transportation_id_class_unique", + "columnNames": [ + "transportation_id", + "class" + ], + "composite": true, + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "transportation_class_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "transportation_class_transportation_id_foreign": { + "constraintName": "transportation_class_transportation_id_foreign", + "columnNames": [ + "transportation_id" + ], + "localTableName": "public.transportation_class", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.transportation", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "slug": { + "name": "slug", + "type": "varchar(200)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 200, + "mappedType": "string" + }, + "package_id": { + "name": "package_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "departure_date": { + "name": "departure_date", + "type": "date", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 0, + "mappedType": "date" + }, + "makkah_hotel_id": { + "name": "makkah_hotel_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "madinah_hotel_id": { + "name": "madinah_hotel_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "transportation_id": { + "name": "transportation_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "quad_price": { + "name": "quad_price", + "type": "numeric(10,0)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "precision": 10, + "scale": 0, + "mappedType": "decimal" + }, + "triple_price": { + "name": "triple_price", + "type": "numeric(10,0)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "precision": 10, + "scale": 0, + "mappedType": "decimal" + }, + "double_price": { + "name": "double_price", + "type": "numeric(10,0)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "precision": 10, + "scale": 0, + "mappedType": "decimal" + }, + "infant_price": { + "name": "infant_price", + "type": "numeric(10,0)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "precision": 10, + "scale": 0, + "mappedType": "decimal" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "package_detail", + "schema": "public", + "indexes": [ + { + "columnNames": [ + "slug" + ], + "composite": false, + "keyName": "package_detail_slug_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "package_detail_package_id_departure_date_unique", + "columnNames": [ + "package_id", + "departure_date" + ], + "composite": true, + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "package_detail_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "package_detail_package_id_foreign": { + "constraintName": "package_detail_package_id_foreign", + "columnNames": [ + "package_id" + ], + "localTableName": "public.package_detail", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.package", + "updateRule": "cascade" + }, + "package_detail_makkah_hotel_id_foreign": { + "constraintName": "package_detail_makkah_hotel_id_foreign", + "columnNames": [ + "makkah_hotel_id" + ], + "localTableName": "public.package_detail", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.hotel", + "updateRule": "cascade" + }, + "package_detail_madinah_hotel_id_foreign": { + "constraintName": "package_detail_madinah_hotel_id_foreign", + "columnNames": [ + "madinah_hotel_id" + ], + "localTableName": "public.package_detail", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.hotel", + "updateRule": "cascade" + }, + "package_detail_transportation_id_foreign": { + "constraintName": "package_detail_transportation_id_foreign", + "columnNames": [ + "transportation_id" + ], + "localTableName": "public.package_detail", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.transportation_class", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "serial", + "unsigned": false, + "autoincrement": true, + "primary": true, + "nullable": false, + "mappedType": "integer" + }, + "package_detail_id": { + "name": "package_detail_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "hotel_id": { + "name": "hotel_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + } + }, + "name": "package_detail_tour_hotels", + "schema": "public", + "indexes": [ + { + "keyName": "package_detail_tour_hotels_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "package_detail_tour_hotels_package_detail_id_foreign": { + "constraintName": "package_detail_tour_hotels_package_detail_id_foreign", + "columnNames": [ + "package_detail_id" + ], + "localTableName": "public.package_detail_tour_hotels", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.package_detail", + "deleteRule": "cascade", + "updateRule": "cascade" + }, + "package_detail_tour_hotels_hotel_id_foreign": { + "constraintName": "package_detail_tour_hotels_hotel_id_foreign", + "columnNames": [ + "hotel_id" + ], + "localTableName": "public.package_detail_tour_hotels", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.hotel", + "deleteRule": "cascade", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "serial", + "unsigned": false, + "autoincrement": true, + "primary": true, + "nullable": false, + "mappedType": "integer" + }, + "package_detail_id": { + "name": "package_detail_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "flight_class_id": { + "name": "flight_class_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + } + }, + "name": "package_detail_tour_flight_classes", + "schema": "public", + "indexes": [ + { + "keyName": "package_detail_tour_flight_classes_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "package_detail_tour_flight_classes_package_detail_id_foreign": { + "constraintName": "package_detail_tour_flight_classes_package_detail_id_foreign", + "columnNames": [ + "package_detail_id" + ], + "localTableName": "public.package_detail_tour_flight_classes", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.package_detail", + "deleteRule": "cascade", + "updateRule": "cascade" + }, + "package_detail_tour_flight_classes_flight_class_id_foreign": { + "constraintName": "package_detail_tour_flight_classes_flight_class_id_foreign", + "columnNames": [ + "flight_class_id" + ], + "localTableName": "public.package_detail_tour_flight_classes", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.flight_class", + "deleteRule": "cascade", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "serial", + "unsigned": false, + "autoincrement": true, + "primary": true, + "nullable": false, + "mappedType": "integer" + }, + "package_detail_id": { + "name": "package_detail_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "flight_class_id": { + "name": "flight_class_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + } + }, + "name": "package_detail_outbound_flight_classes", + "schema": "public", + "indexes": [ + { + "keyName": "package_detail_outbound_flight_classes_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "package_detail_outbound_flight_classes_package_d_8b70d_foreign": { + "constraintName": "package_detail_outbound_flight_classes_package_d_8b70d_foreign", + "columnNames": [ + "package_detail_id" + ], + "localTableName": "public.package_detail_outbound_flight_classes", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.package_detail", + "deleteRule": "cascade", + "updateRule": "cascade" + }, + "package_detail_outbound_flight_classes_flight_class_id_foreign": { + "constraintName": "package_detail_outbound_flight_classes_flight_class_id_foreign", + "columnNames": [ + "flight_class_id" + ], + "localTableName": "public.package_detail_outbound_flight_classes", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.flight_class", + "deleteRule": "cascade", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "serial", + "unsigned": false, + "autoincrement": true, + "primary": true, + "nullable": false, + "mappedType": "integer" + }, + "package_detail_id": { + "name": "package_detail_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "flight_class_id": { + "name": "flight_class_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + } + }, + "name": "package_detail_inbound_flight_classes", + "schema": "public", + "indexes": [ + { + "keyName": "package_detail_inbound_flight_classes_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "package_detail_inbound_flight_classes_package_detail_id_foreign": { + "constraintName": "package_detail_inbound_flight_classes_package_detail_id_foreign", + "columnNames": [ + "package_detail_id" + ], + "localTableName": "public.package_detail_inbound_flight_classes", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.package_detail", + "deleteRule": "cascade", + "updateRule": "cascade" + }, + "package_detail_inbound_flight_classes_flight_class_id_foreign": { + "constraintName": "package_detail_inbound_flight_classes_flight_class_id_foreign", + "columnNames": [ + "flight_class_id" + ], + "localTableName": "public.package_detail_inbound_flight_classes", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.flight_class", + "deleteRule": "cascade", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, + { + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "transportation_class_id": { + "name": "transportation_class_id", + "type": "varchar(30)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 30, + "mappedType": "string" + }, + "src": { + "name": "src", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "created_at": { + "name": "created_at", + "type": "varchar(100)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 100, + "mappedType": "string" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "mappedType": "datetime" + } + }, + "name": "transportation_class_image", + "schema": "public", + "indexes": [ + { + "keyName": "transportation_class_image_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "transportation_class_image_transportation_class_id_foreign": { + "constraintName": "transportation_class_image_transportation_class_id_foreign", + "columnNames": [ + "transportation_class_id" + ], + "localTableName": "public.transportation_class_image", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.transportation_class", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + } + ], + "nativeEnums": {} +} diff --git a/src/database/migrations/Migration20251104110158.ts b/src/database/migrations/Migration20251104110158.ts new file mode 100644 index 0000000..91f17ae --- /dev/null +++ b/src/database/migrations/Migration20251104110158.ts @@ -0,0 +1,367 @@ +import { Migration } from "@mikro-orm/migrations"; + +export class Migration20251104110158 extends Migration { + override async up(): Promise { + this.addSql( + `create table "airline" ("id" varchar(30) not null, "code" varchar(10) not null, "slug" varchar(200) not null, "name" varchar(100) not null, "logo" varchar(100) not null, "skytrax_rating" int null, "skytrax_type" text check ("skytrax_type" in ('full_service', 'low_cost')) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "airline_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "airline" add constraint "airline_code_unique" unique ("code");`, + ); + this.addSql( + `alter table "airline" add constraint "airline_slug_unique" unique ("slug");`, + ); + this.addSql( + `alter table "airline" add constraint "airline_logo_unique" unique ("logo");`, + ); + + this.addSql( + `create table "country" ("id" varchar(30) not null, "slug" varchar(200) not null, "name" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "country_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "country" add constraint "country_slug_unique" unique ("slug");`, + ); + + this.addSql( + `create table "city" ("id" varchar(30) not null, "slug" varchar(200) not null, "name" varchar(100) not null, "country_id" varchar(30) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "city_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "city" add constraint "city_slug_unique" unique ("slug");`, + ); + + this.addSql( + `create table "airport" ("id" varchar(30) not null, "code" varchar(10) not null, "slug" varchar(200) not null, "name" varchar(100) not null, "city_id" varchar(30) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "airport_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "airport" add constraint "airport_code_unique" unique ("code");`, + ); + this.addSql( + `alter table "airport" add constraint "airport_slug_unique" unique ("slug");`, + ); + + this.addSql( + `create table "flight" ("id" varchar(30) not null, "slug" varchar(220) not null, "airline_id" varchar(30) not null, "number" int not null, "departure_airport_id" varchar(30) not null, "departure_terminal" varchar(100) null, "departure_gate" varchar(100) null, "departure_time" time(0) not null, "arrival_airport_id" varchar(30) not null, "arrival_terminal" varchar(100) null, "arrival_gate" varchar(100) null, "duration" int not null, "aircraft" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "flight_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "flight" add constraint "flight_slug_unique" unique ("slug");`, + ); + this.addSql( + `alter table "flight" add constraint "flight_airline_id_number_unique" unique ("airline_id", "number");`, + ); + + this.addSql( + `create table "flight_class" ("id" varchar(30) not null, "slug" varchar(420) not null, "flight_id" varchar(30) not null, "class" varchar(100) not null, "seat_layout" varchar(10) not null, "baggage" int not null, "cabin_baggage" int not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "flight_class_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "flight_class" add constraint "flight_class_slug_unique" unique ("slug");`, + ); + this.addSql( + `alter table "flight_class" add constraint "flight_class_flight_id_class_unique" unique ("flight_id", "class");`, + ); + + this.addSql( + `create table "hotel" ("id" varchar(30) not null, "slug" varchar(200) not null, "name" varchar(100) not null, "city_id" varchar(30) not null, "star" int not null, "google_maps_link" varchar(500) not null, "google_maps_embed" varchar(500) not null, "google_reviews_link" varchar(500) not null, "description" varchar(1000) not null, "address" varchar(100) not null, "landmark" varchar(100) not null, "distance_to_landmark" numeric(10,0) not null, "food_type" varchar(100) not null, "food_amount" int not null, "food_menu" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "hotel_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "hotel" add constraint "hotel_slug_unique" unique ("slug");`, + ); + + this.addSql( + `create table "hotel_facility" ("id" varchar(30) not null, "slug" varchar(200) not null, "name" varchar(100) not null, "icon" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "hotel_facility_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "hotel_facility" add constraint "hotel_facility_slug_unique" unique ("slug");`, + ); + + this.addSql( + `create table "hotel_facilities" ("hotel_id" varchar(30) not null, "hotel_facility_id" varchar(30) not null, constraint "hotel_facilities_pkey" primary key ("hotel_id", "hotel_facility_id"));`, + ); + + this.addSql( + `create table "hotel_image" ("id" varchar(30) not null, "hotel_id" varchar(30) not null, "src" varchar(100) not null, "created_at" varchar(100) not null, "updated_at" timestamptz not null, constraint "hotel_image_pkey" primary key ("id"));`, + ); + + this.addSql( + `create table "package" ("id" varchar(30) not null, "slug" varchar(200) not null, "name" varchar(100) not null, "type" text check ("type" in ('reguler', 'plus')) not null, "class" text check ("class" in ('silver', 'gold', 'platinum')) not null, "thumbnail" varchar(100) not null, "use_fast_train" boolean not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "package_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "package" add constraint "package_slug_unique" unique ("slug");`, + ); + this.addSql( + `alter table "package" add constraint "package_thumbnail_unique" unique ("thumbnail");`, + ); + + this.addSql( + `create table "transportation" ("id" varchar(30) not null, "slug" varchar(100) not null, "name" varchar(100) not null, "type" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "transportation_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "transportation" add constraint "transportation_slug_unique" unique ("slug");`, + ); + + this.addSql( + `create table "transportation_class" ("id" varchar(30) not null, "slug" varchar(400) not null, "transportation_id" varchar(30) not null, "class" varchar(100) not null, "total_seats" int not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "transportation_class_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "transportation_class" add constraint "transportation_class_slug_unique" unique ("slug");`, + ); + this.addSql( + `alter table "transportation_class" add constraint "transportation_class_transportation_id_class_unique" unique ("transportation_id", "class");`, + ); + + this.addSql( + `create table "package_detail" ("id" varchar(30) not null, "slug" varchar(200) not null, "package_id" varchar(30) not null, "departure_date" date not null, "makkah_hotel_id" varchar(30) not null, "madinah_hotel_id" varchar(30) not null, "transportation_id" varchar(30) not null, "quad_price" numeric(10,0) not null, "triple_price" numeric(10,0) not null, "double_price" numeric(10,0) not null, "infant_price" numeric(10,0) null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "package_detail_pkey" primary key ("id"));`, + ); + this.addSql( + `alter table "package_detail" add constraint "package_detail_slug_unique" unique ("slug");`, + ); + this.addSql( + `alter table "package_detail" add constraint "package_detail_package_id_departure_date_unique" unique ("package_id", "departure_date");`, + ); + + this.addSql( + `create table "package_detail_tour_hotels" ("id" serial primary key, "package_detail_id" varchar(30) not null, "hotel_id" varchar(30) not null);`, + ); + + this.addSql( + `create table "package_detail_tour_flight_classes" ("id" serial primary key, "package_detail_id" varchar(30) not null, "flight_class_id" varchar(30) not null);`, + ); + + this.addSql( + `create table "package_detail_outbound_flight_classes" ("id" serial primary key, "package_detail_id" varchar(30) not null, "flight_class_id" varchar(30) not null);`, + ); + + this.addSql( + `create table "package_detail_inbound_flight_classes" ("id" serial primary key, "package_detail_id" varchar(30) not null, "flight_class_id" varchar(30) not null);`, + ); + + this.addSql( + `create table "transportation_class_image" ("id" varchar(30) not null, "transportation_class_id" varchar(30) not null, "src" varchar(100) not null, "created_at" varchar(100) not null, "updated_at" timestamptz not null, constraint "transportation_class_image_pkey" primary key ("id"));`, + ); + + this.addSql( + `alter table "city" add constraint "city_country_id_foreign" foreign key ("country_id") references "country" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "airport" add constraint "airport_city_id_foreign" foreign key ("city_id") references "city" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "flight" add constraint "flight_airline_id_foreign" foreign key ("airline_id") references "airline" ("id") on update cascade;`, + ); + this.addSql( + `alter table "flight" add constraint "flight_departure_airport_id_foreign" foreign key ("departure_airport_id") references "airport" ("id") on update cascade;`, + ); + this.addSql( + `alter table "flight" add constraint "flight_arrival_airport_id_foreign" foreign key ("arrival_airport_id") references "airport" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "flight_class" add constraint "flight_class_flight_id_foreign" foreign key ("flight_id") references "flight" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "hotel" add constraint "hotel_city_id_foreign" foreign key ("city_id") references "city" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "hotel_facilities" add constraint "hotel_facilities_hotel_id_foreign" foreign key ("hotel_id") references "hotel" ("id") on update cascade on delete cascade;`, + ); + this.addSql( + `alter table "hotel_facilities" add constraint "hotel_facilities_hotel_facility_id_foreign" foreign key ("hotel_facility_id") references "hotel_facility" ("id") on update cascade on delete cascade;`, + ); + + this.addSql( + `alter table "hotel_image" add constraint "hotel_image_hotel_id_foreign" foreign key ("hotel_id") references "hotel" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "transportation_class" add constraint "transportation_class_transportation_id_foreign" foreign key ("transportation_id") references "transportation" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "package_detail" add constraint "package_detail_package_id_foreign" foreign key ("package_id") references "package" ("id") on update cascade;`, + ); + this.addSql( + `alter table "package_detail" add constraint "package_detail_makkah_hotel_id_foreign" foreign key ("makkah_hotel_id") references "hotel" ("id") on update cascade;`, + ); + this.addSql( + `alter table "package_detail" add constraint "package_detail_madinah_hotel_id_foreign" foreign key ("madinah_hotel_id") references "hotel" ("id") on update cascade;`, + ); + this.addSql( + `alter table "package_detail" add constraint "package_detail_transportation_id_foreign" foreign key ("transportation_id") references "transportation_class" ("id") on update cascade;`, + ); + + this.addSql( + `alter table "package_detail_tour_hotels" add constraint "package_detail_tour_hotels_package_detail_id_foreign" foreign key ("package_detail_id") references "package_detail" ("id") on update cascade on delete cascade;`, + ); + this.addSql( + `alter table "package_detail_tour_hotels" add constraint "package_detail_tour_hotels_hotel_id_foreign" foreign key ("hotel_id") references "hotel" ("id") on update cascade on delete cascade;`, + ); + + this.addSql( + `alter table "package_detail_tour_flight_classes" add constraint "package_detail_tour_flight_classes_package_detail_id_foreign" foreign key ("package_detail_id") references "package_detail" ("id") on update cascade on delete cascade;`, + ); + this.addSql( + `alter table "package_detail_tour_flight_classes" add constraint "package_detail_tour_flight_classes_flight_class_id_foreign" foreign key ("flight_class_id") references "flight_class" ("id") on update cascade on delete cascade;`, + ); + + this.addSql( + `alter table "package_detail_outbound_flight_classes" add constraint "package_detail_outbound_flight_classes_package_d_8b70d_foreign" foreign key ("package_detail_id") references "package_detail" ("id") on update cascade on delete cascade;`, + ); + this.addSql( + `alter table "package_detail_outbound_flight_classes" add constraint "package_detail_outbound_flight_classes_flight_class_id_foreign" foreign key ("flight_class_id") references "flight_class" ("id") on update cascade on delete cascade;`, + ); + + this.addSql( + `alter table "package_detail_inbound_flight_classes" add constraint "package_detail_inbound_flight_classes_package_detail_id_foreign" foreign key ("package_detail_id") references "package_detail" ("id") on update cascade on delete cascade;`, + ); + this.addSql( + `alter table "package_detail_inbound_flight_classes" add constraint "package_detail_inbound_flight_classes_flight_class_id_foreign" foreign key ("flight_class_id") references "flight_class" ("id") on update cascade on delete cascade;`, + ); + + this.addSql( + `alter table "transportation_class_image" add constraint "transportation_class_image_transportation_class_id_foreign" foreign key ("transportation_class_id") references "transportation_class" ("id") on update cascade;`, + ); + } + + override async down(): Promise { + this.addSql( + `alter table "flight" drop constraint "flight_airline_id_foreign";`, + ); + + this.addSql( + `alter table "city" drop constraint "city_country_id_foreign";`, + ); + + this.addSql( + `alter table "airport" drop constraint "airport_city_id_foreign";`, + ); + + this.addSql(`alter table "hotel" drop constraint "hotel_city_id_foreign";`); + + this.addSql( + `alter table "flight" drop constraint "flight_departure_airport_id_foreign";`, + ); + + this.addSql( + `alter table "flight" drop constraint "flight_arrival_airport_id_foreign";`, + ); + + this.addSql( + `alter table "flight_class" drop constraint "flight_class_flight_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail_tour_flight_classes" drop constraint "package_detail_tour_flight_classes_flight_class_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail_outbound_flight_classes" drop constraint "package_detail_outbound_flight_classes_flight_class_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail_inbound_flight_classes" drop constraint "package_detail_inbound_flight_classes_flight_class_id_foreign";`, + ); + + this.addSql( + `alter table "hotel_facilities" drop constraint "hotel_facilities_hotel_id_foreign";`, + ); + + this.addSql( + `alter table "hotel_image" drop constraint "hotel_image_hotel_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail" drop constraint "package_detail_makkah_hotel_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail" drop constraint "package_detail_madinah_hotel_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail_tour_hotels" drop constraint "package_detail_tour_hotels_hotel_id_foreign";`, + ); + + this.addSql( + `alter table "hotel_facilities" drop constraint "hotel_facilities_hotel_facility_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail" drop constraint "package_detail_package_id_foreign";`, + ); + + this.addSql( + `alter table "transportation_class" drop constraint "transportation_class_transportation_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail" drop constraint "package_detail_transportation_id_foreign";`, + ); + + this.addSql( + `alter table "transportation_class_image" drop constraint "transportation_class_image_transportation_class_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail_tour_hotels" drop constraint "package_detail_tour_hotels_package_detail_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail_tour_flight_classes" drop constraint "package_detail_tour_flight_classes_package_detail_id_foreign";`, + ); + + this.addSql( + `alter table "package_detail_outbound_flight_classes" drop constraint "package_detail_outbound_flight_classes_package_d_8b70d_foreign";`, + ); + + this.addSql( + `alter table "package_detail_inbound_flight_classes" drop constraint "package_detail_inbound_flight_classes_package_detail_id_foreign";`, + ); + + this.addSql(`drop table if exists "airline" cascade;`); + + this.addSql(`drop table if exists "country" cascade;`); + + this.addSql(`drop table if exists "city" cascade;`); + + this.addSql(`drop table if exists "airport" cascade;`); + + this.addSql(`drop table if exists "flight" cascade;`); + + this.addSql(`drop table if exists "flight_class" cascade;`); + + this.addSql(`drop table if exists "hotel" cascade;`); + + this.addSql(`drop table if exists "hotel_facility" cascade;`); + + this.addSql(`drop table if exists "hotel_facilities" cascade;`); + + this.addSql(`drop table if exists "hotel_image" cascade;`); + + this.addSql(`drop table if exists "package" cascade;`); + + this.addSql(`drop table if exists "transportation" cascade;`); + + this.addSql(`drop table if exists "transportation_class" cascade;`); + + this.addSql(`drop table if exists "package_detail" cascade;`); + + this.addSql(`drop table if exists "package_detail_tour_hotels" cascade;`); + + this.addSql( + `drop table if exists "package_detail_tour_flight_classes" cascade;`, + ); + + this.addSql( + `drop table if exists "package_detail_outbound_flight_classes" cascade;`, + ); + + this.addSql( + `drop table if exists "package_detail_inbound_flight_classes" cascade;`, + ); + + this.addSql(`drop table if exists "transportation_class_image" cascade;`); + } +} diff --git a/src/database/orm.ts b/src/database/orm.ts new file mode 100644 index 0000000..e0b7687 --- /dev/null +++ b/src/database/orm.ts @@ -0,0 +1,12 @@ +import { databaseConfig } from "@/configs/database.config"; +import { MikroORM } from "@mikro-orm/postgresql"; + +export const orm = await MikroORM.init({ + host: databaseConfig.host, + port: databaseConfig.port, + user: databaseConfig.username, + password: databaseConfig.password, + dbName: databaseConfig.name, + entities: ["src/database/entities/*.entity.ts"], + entitiesTs: ["src/database/entities/*.entity.ts"], +}); diff --git a/src/server.ts b/src/server.ts index 30a60e7..1d02bb2 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,3 +1,5 @@ +import "reflect-metadata"; + import { Application } from "@/application"; process.on("uncaughtException", (err) => { diff --git a/tsconfig.json b/tsconfig.json index 6ba655a..e07fe35 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,9 @@ "strict": true, "verbatimModuleSyntax": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "baseUrl": "src", "paths": { "@/*": ["./*"]