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
510aeb02
Commit
510aeb02
authored
3 years ago
by
alrwasheda
Browse files
Options
Downloads
Patches
Plain Diff
name changed -> deleted
parent
006036d8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/src/db/createInitialWorker.ts
+0
-23
0 additions, 23 deletions
server/src/db/createInitialWorker.ts
server/src/db/models/Worker.ts
+0
-63
0 additions, 63 deletions
server/src/db/models/Worker.ts
with
0 additions
and
86 deletions
server/src/db/createInitialWorker.ts
deleted
100644 → 0
+
0
−
23
View file @
006036d8
import
bcrypt
from
"
bcrypt
"
;
import
envVars
from
"
../config
"
;
import
Worker
from
"
./models/Worker
"
;
const
createInitialWorkerIfNotExists
=
async
()
=>
{
const
numberOfWorkers
=
await
Worker
.
count
();
if
(
numberOfWorkers
===
0
)
{
const
initialCoordinatorPassword
=
envVars
.
INITIAL_COORDINATOR_PASSWORD
;
const
initialCoordinatorEmail
=
envVars
.
INITIAL_COORDINATOR_EMAIL
;
const
hashedPassword
=
await
bcrypt
.
hash
(
initialCoordinatorPassword
,
10
);
await
Worker
.
create
({
email
:
initialCoordinatorEmail
,
password
:
hashedPassword
,
first_name
:
"
coordinator_firstName
"
,
last_name
:
"
coordinator_lastName
"
,
role
:
"
coordinator
"
,
});
}
};
export
default
createInitialWorkerIfNotExists
;
This diff is collapsed.
Click to expand it.
server/src/db/models/Worker.ts
deleted
100644 → 0
+
0
−
63
View file @
006036d8
import
{
DataTypes
,
Model
,
Optional
,
Sequelize
}
from
"
sequelize
"
;
interface
WorkerAttributes
{
id
:
string
;
email
:
string
;
first_name
:
string
;
last_name
:
string
;
password
:
string
;
role
:
string
;
}
export
interface
WorkerInput
extends
Optional
<
WorkerAttributes
,
"
id
"
>
{}
class
Worker
extends
Model
<
WorkerAttributes
,
WorkerInput
>
implements
WorkerAttributes
{
declare
id
:
string
;
declare
email
:
string
;
declare
first_name
:
string
;
declare
last_name
:
string
;
declare
password
:
string
;
declare
role
:
string
;
declare
readonly
createdAt
:
Date
;
declare
readonly
updatedAt
:
Date
;
}
export
const
initWorker
=
async
(
sequelizeConnection
:
Sequelize
)
=>
{
Worker
.
init
(
{
id
:
{
type
:
DataTypes
.
UUID
,
defaultValue
:
DataTypes
.
UUIDV4
,
primaryKey
:
true
,
allowNull
:
false
,
},
email
:
{
type
:
new
DataTypes
.
STRING
(),
allowNull
:
false
,
unique
:
true
,
},
first_name
:
{
type
:
new
DataTypes
.
STRING
(),
allowNull
:
false
,
},
last_name
:
{
type
:
new
DataTypes
.
STRING
(),
allowNull
:
false
,
},
password
:
{
type
:
new
DataTypes
.
STRING
(),
allowNull
:
false
,
},
role
:
{
type
:
new
DataTypes
.
STRING
(),
allowNull
:
false
,
},
},
{
tableName
:
"
worker
"
,
sequelize
:
sequelizeConnection
,
}
);
};
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