Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gdd-sigma-poc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Guillaume WANG
gdd-sigma-poc
Commits
cb1f1f67
Commit
cb1f1f67
authored
6 years ago
by
Guilhem ROY
Browse files
Options
Downloads
Patches
Plain Diff
requestModels.ts : mutations création requetes
parent
0424ee7a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/graphql/models/requestModel.ts
+6
-2
6 additions, 2 deletions
src/graphql/models/requestModel.ts
src/graphql/resolvers.ts
+3
-3
3 additions, 3 deletions
src/graphql/resolvers.ts
with
9 additions
and
5 deletions
src/graphql/models/requestModel.ts
+
6
−
2
View file @
cb1f1f67
...
...
@@ -136,7 +136,8 @@ export class RequestModel {
* @rights viewer du groupe
*/
async
userRequestJoinGroup
(
gid
:
string
,
comment
:
string
):
Promise
<
UserJoinGroup
>
{
throw
"
Not implemented
"
;
let
res
=
await
knex
(
"
requests_user_join_group
"
).
insert
({
request_to
:
gid
,
request_from
:
this
.
contextUser
,
request_comment
:
comment
},
[
'
rid
'
]);
return
this
.
getUserJoinGroupRequest
(
res
[
0
][
"
rid
"
]);
}
/**
...
...
@@ -154,6 +155,8 @@ export class RequestModel {
async
groupRequestCoauthorEvent
(
from_gid
:
string
,
to_gid
:
string
,
event_mid
:
number
,
comment
:
string
):
Promise
<
GroupCoauthorEvent
>
{
//TODO : Vérifier que l'évenement est bien organisé par le groupe destinataire (to_gid) !!! => sinon erreur
throw
"
Not implemented
"
;
let
res
=
await
knex
(
"
requests_group_coauthor_event
"
).
insert
({
request_to
:
to_gid
,
request_from
:
from_gid
,
request_comment
:
comment
,
for_event
:
event_mid
},
[
'
rid
'
]);
return
this
.
getGroupCoauthorEventRequest
(
res
[
0
][
"
rid
"
]);
}
/**
...
...
@@ -168,7 +171,8 @@ export class RequestModel {
* @rights admin du groupe émetteur
*/
async
groupRequestJoinMetagroup
(
from_gid
:
string
,
to_gid
:
string
,
comment
:
string
):
Promise
<
GroupJoinMetagroup
>
{
throw
"
Not implemented
"
;
let
res
=
await
knex
(
"
requests_group_join_metagroup
"
).
insert
({
request_to
:
to_gid
,
request_from
:
from_gid
,
request_comment
:
comment
},
[
'
rid
'
]);
return
this
.
getGroupJoinMetagroupRequest
(
res
[
0
][
"
rid
"
]);
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/graphql/resolvers.ts
+
3
−
3
View file @
cb1f1f67
...
...
@@ -109,7 +109,7 @@ export const resolvers = {
// @rights admin du groupe destinaire ou le user émetteur
userJoinGroupRequest
:
async
function
(
root
,
args
,
context
:
Context
):
Promise
<
UserJoinGroup
>
{
let
r
=
await
context
.
models
.
request
.
getUserJoinGroupRequest
(
args
.
rid
);
if
(
context
.
models
.
auth
.
isAdmin
((
await
r
.
to
(
args
,
context
,
""
)).
gid
)
||
context
.
models
.
auth
.
getUid
()
==
(
await
r
.
from
(
args
,
context
,
""
)).
uid
)
{
if
(
!
r
||
context
.
models
.
auth
.
isAdmin
((
await
r
.
to
(
args
,
context
,
""
)).
gid
)
||
context
.
models
.
auth
.
getUid
()
==
(
await
r
.
from
(
args
,
context
,
""
)).
uid
)
{
return
r
;
}
throw
new
AuthenticationError
(
"
Not an admin
"
);
...
...
@@ -118,7 +118,7 @@ export const resolvers = {
// @rights admin du groupe émetteur ou destinataire
groupJoinMetagroupRequest
:
async
function
(
root
,
args
,
context
:
Context
):
Promise
<
GroupJoinMetagroup
>
{
let
r
=
await
context
.
models
.
request
.
getGroupJoinMetagroupRequest
(
args
.
rid
);
if
(
context
.
models
.
auth
.
isAdmin
((
await
r
.
to
(
args
,
context
,
""
)).
gid
)
||
context
.
models
.
auth
.
isAdmin
((
await
r
.
from
(
args
,
context
,
""
)).
gid
))
{
if
(
!
r
||
context
.
models
.
auth
.
isAdmin
((
await
r
.
to
(
args
,
context
,
""
)).
gid
)
||
context
.
models
.
auth
.
isAdmin
((
await
r
.
from
(
args
,
context
,
""
)).
gid
))
{
return
r
;
}
throw
new
AuthenticationError
(
"
Not an admin
"
);
...
...
@@ -127,7 +127,7 @@ export const resolvers = {
// @rights admin du groupe émetteur ou destinataire
groupCoauthorEventRequest
:
async
function
(
root
,
args
,
context
:
Context
):
Promise
<
GroupCoauthorEvent
>
{
let
r
=
await
context
.
models
.
request
.
getGroupCoauthorEventRequest
(
args
.
rid
);
if
(
context
.
models
.
auth
.
isAdmin
((
await
r
.
to
(
args
,
context
,
""
)).
gid
)
||
context
.
models
.
auth
.
isAdmin
((
await
r
.
from
(
args
,
context
,
""
)).
gid
))
{
if
(
!
r
||
context
.
models
.
auth
.
isAdmin
((
await
r
.
to
(
args
,
context
,
""
)).
gid
)
||
context
.
models
.
auth
.
isAdmin
((
await
r
.
from
(
args
,
context
,
""
)).
gid
))
{
return
r
;
}
throw
new
AuthenticationError
(
"
Not an admin
"
);
...
...
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