From ae31dc3de5dc8c4e31858835a3411c218f7a1427 Mon Sep 17 00:00:00 2001
From: Hanen Alrwasheda <alrwasheda@mi.fu-berlin.de>
Date: Sun, 12 Dec 2021 19:58:30 +0100
Subject: [PATCH] Wrapper-Functions commented, because sequelize functions can
 be used simply using Model.

---
 server/src/db/models/Worker.ts | 70 +++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 34 deletions(-)

diff --git a/server/src/db/models/Worker.ts b/server/src/db/models/Worker.ts
index d8eaeb7..972f8d7 100644
--- a/server/src/db/models/Worker.ts
+++ b/server/src/db/models/Worker.ts
@@ -7,8 +7,8 @@ interface WorkerAttributes {
   password: string;
   role: string;
 }
-export interface WorkerInput extends Optional<WorkerAttributes, "email"> { }
-export interface WorkerOutput extends Required<WorkerAttributes> { }
+export interface WorkerInput extends Optional<WorkerAttributes, "email"> {}
+export interface WorkerOutput extends Required<WorkerAttributes> {}
 class Worker extends Model<WorkerAttributes> implements WorkerAttributes {
   public email!: string;
   public firstName: string;
@@ -20,38 +20,40 @@ class Worker extends Model<WorkerAttributes> implements WorkerAttributes {
   public readonly updatedAt!: Date;
 }
 export const initWorker = async (sequelizeConnection: Sequelize) => {
-
-Worker.init(
-  {
-    email: {
-      type: new DataTypes.STRING(),
-      allowNull: false,
-      primaryKey: true,
-      unique: true,
-    },
-    firstName: {
-      type: new DataTypes.STRING(),
-      allowNull: false,
-    },
-    lastName: {
-      type: new DataTypes.STRING(),
-      allowNull: false,
-    },
-    password: {
-      type: new DataTypes.STRING(),
-      allowNull: false,
-    },
-    role: {
-      type: new DataTypes.STRING(),
-      allowNull: false,
+  Worker.init(
+    {
+      email: {
+        type: new DataTypes.STRING(),
+        allowNull: false,
+        primaryKey: true,
+        unique: true,
+      },
+      firstName: {
+        type: new DataTypes.STRING(),
+        allowNull: false,
+      },
+      lastName: {
+        type: new DataTypes.STRING(),
+        allowNull: false,
+      },
+      password: {
+        type: new DataTypes.STRING(),
+        allowNull: false,
+      },
+      role: {
+        type: new DataTypes.STRING(),
+        allowNull: false,
+      },
     },
-  },
-  {
-    tableName: "worker",
-    sequelize: sequelizeConnection,
-  }
-);
-}
+    {
+      tableName: "worker",
+      sequelize: sequelizeConnection,
+    }
+  );
+};
+/*
+--------------------------all those wrapper-functions are not needed. Query-functions can be calles simply using Model---------------------------------------------------------
+
 
 export const create = async (payload: Worker): Promise<WorkerOutput> => {
   return await Worker.create(payload);
@@ -92,5 +94,5 @@ export const WorkerService = {
   deleteById,
   getAll,
 };
-
+*/
 export default Worker;
-- 
GitLab