From 06ad39c29546d0a5fd831e4cac2ef9df5dfb80f8 Mon Sep 17 00:00:00 2001 From: Hanen Alrwasheda <alrwasheda@mi.fu-berlin.de> Date: Sun, 2 Jan 2022 19:46:11 +0100 Subject: [PATCH] seeder only for testing purposes --- server/src/db/seeder.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 server/src/db/seeder.ts diff --git a/server/src/db/seeder.ts b/server/src/db/seeder.ts new file mode 100644 index 0000000..df779ed --- /dev/null +++ b/server/src/db/seeder.ts @@ -0,0 +1,38 @@ +import Boat from "./models/Boat"; + +const seedBoatTable = async () => { + if ((await Boat.count()) < 1) { + await Boat.create({ + id: 1, + name: "boat one", + status: false, + active: true, + seats: 5, + }); + await Boat.create({ + id: 2, + name: "boat two", + status: false, + active: true, + seats: 4, + }); + await Boat.create({ + id: 3, + name: "boat three", + status: false, + active: false, + seats: 2, + }); + } +}; + +const seedCheckInTable = async () => {}; +const seedCustomerTable = async () => {}; + +const runSeeders = async () => { + await seedBoatTable(); + await seedCheckInTable(); + await seedCustomerTable(); +}; + +export default runSeeders; -- GitLab