Skip to content
Snippets Groups Projects
Commit c20ed528 authored by Anatole ROMON's avatar Anatole ROMON
Browse files

Deplacement

parent 24df1e74
No related branches found
No related tags found
No related merge requests found
......@@ -4,9 +4,12 @@
*/
import { makeExecutableSchema } from 'graphql-tools';
import typeDefs from './typeDefs';
import actionDefs from './typeDefs/actions';
import objectDefs from './typeDefs/objects';
import { resolvers } from './resolvers';
const typeDefs = actionDefs.concat(objectDefs);
const schema = makeExecutableSchema({
typeDefs,
resolvers
......
const RootTypes = `
# Requêtes
type Query {
accessGroups : GroupQuery
accessPosts : MessageQuery
accessUsers : UserQuery
asAdmin(groupUID: ID): AdminQuery
asSpeaker(groupUID: ID): AdminQuery
asMember(groupUID: ID): MemberQuery
asViewer(groupUID: ID): AdminQuery
}
type Mutation {
asAdmin(groupUID: String): AdminMutation
asSpeaker(groupUID: String): SpeakerMutation
asMember(groupUID: String): MemberMutation
asViewer(groupUID: String): ViewerMutation
}
`;
const subMutations = `
type AdminMutation {
isAdmin: Boolean
createSubgroup(
uid: ID = null,
name: String,
website: String,
description: String,
school: String
): Group
addUser(userid : String): User
removeUser(userid : String): User
addAdmin(userid : String): User
removeAdmin(userid : String): User
editGroup(
name: String,
website: String,
description: String,
school: String
): Group
}
type SpeakerMutation{
postEvent(name: String, date: String): Event
answerEventRequest(request: ID, accept : Boolean): Request
}
type MemberMutation {
leave: Group
}
type ViewerMutation {
requestJoin: Group
}
`;
const subQueries = `
"""
Requête pour obtenir un groupe.
"""
type GroupQuery{
allGroups: [Group]
allSimpleGroups: [SimpleGroup]
group(uid: ID) : Group
simpleGroup(uid : ID) : SimpleGroup
metaGroup(uid : ID) : MetaGroup
}
"""
Requête pour obtenir un message.
"""
type MessageQuery{
allMessages: [Message]
allEvents: [Event]
allPosts: [Post]
post(id: ID): Post
allAnnouncements: [Announcement]
}
type UserQuery{
user(uid: ID) : User
searchTOL(
givenName: String,
lastName: String,
nickname: String,
nationality: String,
school: String,
promotion: String,
groups: String,
studies: String,
sport: String,
phone: String,
mail: String,
adress: String,
ip: String
): [String]
}
# Requête à la base de donnée nécessitant d'être administrateur.
type AdminQuery{
isAdmin: Boolean
allRequests : AllRequests
}
type SpeakerQuery{
isSpeaker: Boolean
}
type MemberQuery{
isMember: Boolean
allMembers : [Group]
}
type ViewerQuery{
isViewer: Boolean
}
`;
const actionDefs = [RootTypes, subQueries ];
export default typeDefs;
const RootTypes = `
# Requêtes
type Query {
accessGroups : GroupQuery
accessPosts : MessageQuery
accessUsers : UserQuery
asAdmin(groupUID: ID): AdminQuery
asSpeaker(groupUID: ID): AdminQuery
asMember(groupUID: ID): MemberQuery
asViewer(groupUID: ID): AdminQuery
}
type Mutation {
asAdmin(groupUID: String): AdminMutation
asSpeaker(groupUID: String): SpeakerMutation
asMember(groupUID: String): MemberMutation
asViewer(groupUID: String): ViewerMutation
}
`;
const subMutations = `
type AdminMutation {
isAdmin: Boolean
createSubgroup(
uid: ID = null,
name: String,
website: String,
description: String,
school: String
): Group
addUser(userid : String): User
removeUser(userid : String): User
addAdmin(userid : String): User
removeAdmin(userid : String): User
editGroup(
name: String,
website: String,
description: String,
school: String
): Group
}
type SpeakerMutation{
postEvent(name: String, date: String): Event
answerEventRequest(request: ID, accept : Boolean): Request
}
type MemberMutation {
leave: Group
}
type ViewerMutation {
requestJoin: Group
}
`;
const subQueries = `
"""
Requête pour obtenir un groupe.
"""
type GroupQuery{
allGroups: [Group]
allSimpleGroups: [SimpleGroup]
group(uid: ID) : Group
simpleGroup(uid : ID) : SimpleGroup
metaGroup(uid : ID) : MetaGroup
}
"""
Requête pour obtenir un message.
"""
type MessageQuery{
allMessages: [Message]
allEvents: [Event]
allPosts: [Post]
post(id: ID): Post
allAnnouncements: [Announcement]
}
type UserQuery{
user(uid: ID) : User
searchTOL(
givenName: String,
lastName: String,
nickname: String,
nationality: String,
school: String,
promotion: String,
groups: String,
studies: String,
sport: String,
phone: String,
mail: String,
adress: String,
ip: String
): [String]
}
# Requête à la base de donnée nécessitant d'être administrateur.
type AdminQuery{
isAdmin: Boolean
allRequests : AllRequests
}
type SpeakerQuery{
isSpeaker: Boolean
}
type MemberQuery{
isMember: Boolean
allMembers : [Group]
}
type ViewerQuery{
isViewer: Boolean
}
`;
const User = `
# Utilisateurs
......@@ -264,7 +131,8 @@ const Event = `
# Organisateurs
authors: [Group]
# Personnes qui participent à l'événement.
participants: [User]
participatingGroups: [Group]
participatingUsers: [User]
description: String
}
`;
......@@ -315,5 +183,5 @@ const Requests = `
`;
const typeDefs = [RootTypes, Group, User, Message, Post, Announcement, Event, subMutations, subQueries, Requests];
export default typeDefs;
const objectDefs = [Group, User, Message, Post, Announcement, Event, subMutations, Requests];
export default typeDefs;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment