Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fahrtenbuch
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWP WS21_22 - Fahrtenbuch
Team Einhorn
fahrtenbuch
Commits
ae31dc3d
Commit
ae31dc3d
authored
3 years ago
by
alrwasheda
Browse files
Options
Downloads
Patches
Plain Diff
Wrapper-Functions commented, because sequelize functions can be used simply using Model.
parent
d3b40390
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/src/db/models/Worker.ts
+36
-34
36 additions, 34 deletions
server/src/db/models/Worker.ts
with
36 additions
and
34 deletions
server/src/db/models/Worker.ts
+
36
−
34
View file @
ae31dc3d
...
...
@@ -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
:
fals
e
,
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
:
tru
e
,
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
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment