Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Database
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
libraries
Database
Merge requests
!132
Sprint/2021 08
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Sprint/2021 08
Sprint/2021-08
into
master
Overview
0
Commits
4
Pipelines
3
Changes
8
Merged
Petar Hristov
requested to merge
Sprint/2021-08
into
master
4 years ago
Overview
0
Commits
4
Pipelines
3
Changes
8
Expand
0
0
Merge request reports
Compare
master
version 1
9bbe1da8
4 years ago
master (base)
and
latest version
latest version
82c18c2a
4 commits,
4 years ago
version 1
9bbe1da8
2 commits,
4 years ago
8 files
+
121
−
11
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
src/Database/Models/InvitationModel.cs
0 → 100644
+
51
−
0
Options
using
Coscine.Database.DataModel
;
using
Microsoft.EntityFrameworkCore
;
using
System
;
using
System.Linq.Expressions
;
namespace
Coscine.Database.Models
{
public
class
InvitationModel
:
DatabaseModel
<
Invitation
>
{
public
override
Expression
<
Func
<
Invitation
,
Guid
>>
GetIdFromObject
()
{
return
databaseObject
=>
databaseObject
.
Id
;
}
public
override
DbSet
<
Invitation
>
GetITableFromDatabase
(
CoscineDB
db
)
{
return
db
.
Invitations
;
}
public
override
void
SetObjectId
(
Invitation
databaseObject
,
Guid
id
)
{
databaseObject
.
Id
=
id
;
}
public
Invitation
GetByToken
(
Guid
token
)
{
return
GetWhere
(
x
=>
x
.
Token
==
token
);
}
public
Guid
CreateInvitation
(
Guid
project
,
Guid
issuer
,
Guid
roleId
,
string
inviteeEmail
)
{
var
token
=
Guid
.
NewGuid
();
Insert
(
new
Invitation
{
Id
=
Guid
.
NewGuid
(),
Project
=
project
,
Issuer
=
issuer
,
Role
=
roleId
,
InviteeEmail
=
inviteeEmail
,
Expiration
=
DateTime
.
UtcNow
.
AddDays
(
7
),
Token
=
token
,
}
);
return
token
;
}
}
}
Loading