Skip to content
Snippets Groups Projects
Commit 576bb901 authored by Wilson JALLET's avatar Wilson JALLET :money_with_wings:
Browse files

Nouveaux groupes, posts, nouveaux champs

parent d291a0e0
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,14 @@ exports.seed = function(knex, Promise) {
website: 'laserwave.fr',
school: 'supoptique',
type : 'simple'
},
{
name: 'WikiX',
uid: 'wikix',
website: 'https://wikix.polytechnique.org/',
school: "polytechnique",
description: "Le recueil de la mémoire des élèves",
type: "simple",
},{
name: 'BDE Ensta',
uid: 'bdeensta',
......@@ -55,6 +63,14 @@ exports.seed = function(knex, Promise) {
school: 'ensta',
type : 'simple'
},
{
name: "X-Chine",
uid: "x-chine",
website: "",
school: "polytechnique",
description: `X-Chine est le binet qui rassemble les amoureux et les curieux de l'Empire du Milieu, qu'ils soient chinois ou non !`,
type: "simple"
},
{
name: 'Subaïsse',
uid: 'subaisse',
......
......@@ -11,6 +11,14 @@ exports.seed = function(knex, Promise) {
title: "Proj'et Promotion",
description: "La nouvelle proj' du JTX arrive !",
authors: ['br']
},{
title: "Fête de la Lune",
description: "C'est bientôt la fête de la Lune ! Inscrivez-vous pour un dîner-spectacle dans le Grand Hall !",
authors: ['x-chine']
},{
title: "Formation Web",
description: "Envie d'apprendre à faire un site Web en Django ? Alors viens en amphi Sauvy ce jeudi à 20h !",
authors: ['br']
}];
return knex('posts').insert(posts);
......
......@@ -234,14 +234,14 @@ export async function getAllVisibleSimpleGroups (user){
return knex.with('visible_groups', visible_groups).select().from("simple_groups").innerJoin('visible_groups', function (){
this.on('visible_groups.uid', '=', 'simple_groups.uid');
});
};
}
export async function getAllVisibleMetaGroups (user){
let visible_groups = await getVisibleGroupCallback(user);
return knex.with('visible_groups', visible_groups).select().from("meta_groups").innerJoin('visible_groups', function (){
this.on('visible_groups.uid', '=', 'meta_groups.uid');
});
};
}
/**
* @summary Renvoie tous les groupes visibles par l'utilisateur user
......@@ -393,19 +393,26 @@ export const getYourGroupHostEventRequests = (user, recipientUID) => {
//Don't forget the argument user is the guy who makes the request, not the user we want
export const getUser = (user, userUID) => {
const refactorer = (data) => {
console.log("type of nick",typeof data.nickname);
if (typeof data.brRoom == 'string') data.brRoom = [data.brRoom];
return {
uid: userUID,
lastName: data.sn,
givenName: data.givenName,
nickname: data.displayName,
nationality: data.country,
birthdate: data.brBirthdate,
groups: data.brMemberOf,
mail: data.mail,
phone: data.telephoneNumber,
room: data.brRoom
address: data.brRoom,
promotion: data.brPromo
};
};
const result = renseignerSurUtilisateur(user, userUID).then(res => {
console.log(res[0]);
return refactorer(res[0]);
});
......@@ -478,4 +485,4 @@ export async function getMetaGroupMembersCallback(user, metaGroupUID){
.innerJoin('meta_group_membership', 'groups.uid', 'meta_group_membership.member_uid')
.where('meta_group_membership.union_uid', '=', metaGroupUID);
};
};
\ No newline at end of file
}
\ No newline at end of file
......@@ -258,16 +258,13 @@ export const resolvers = {
},
SimpleGroup: {
members: (obj, args, context) => {
return connectors.listerMembres(context.user,obj.uid);
}
},
MetaGroup: {
members: (obj, args, context) => {
}
}
};
......@@ -139,6 +139,9 @@ const User = `
givenName: String!
# Nom de famille
lastName: String!
# Surnom
nickname: String
nationality: String
uid: ID!
birthdate: String!
mail: String
......@@ -147,7 +150,10 @@ const User = `
groups: [SimpleGroup]
# Groupes que l'utilisateur aime.
likes: [Group]
address: String
# Adresse(s) de l'utilisateur.
address: [String]
# Promotion
promotion: String
}
`;
......@@ -226,7 +232,7 @@ const Post = `
createdAt: String!
updatedAt: String!
authors: [Group]
content: String!
description: String!
}
`;
......
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