diff --git a/db/migrations/20190202114345_create_announcements_authors.js b/db/migrations/20190202114345_create_announcements_authors.js new file mode 100644 index 0000000000000000000000000000000000000000..e3c8ee1b3c6a23a39d15b9bc59da00a0be2b23d3 --- /dev/null +++ b/db/migrations/20190202114345_create_announcements_authors.js @@ -0,0 +1,18 @@ + +exports.up = function (knex, Promise) { + return knex.schema.createTable('announcements_authors', function (table) { + table.increments('id'); //autoincrementing (non-nullable) primary key + + table.integer('mid').notNullable() + .references('mid').inTable('messages_announcements') + .onDelete('CASCADE'); //if announcement is deleted, also delete authors + + table.string('gid', 128).notNullable() + .references('gid').inTable('groups') + .onDelete('CASCADE'); //if group is deleted, also delete authors + }); +}; + +exports.down = function (knex, Promise) { + return knex.schema.dropTable('announcements_authors'); +}; diff --git a/db/migrations/20190202114346_create_announcements_recipients.js b/db/migrations/20190202114346_create_announcements_recipients.js new file mode 100644 index 0000000000000000000000000000000000000000..dc30eab645076009cc7e49a780307b4925a01f72 --- /dev/null +++ b/db/migrations/20190202114346_create_announcements_recipients.js @@ -0,0 +1,18 @@ + +exports.up = function (knex, Promise) { + return knex.schema.createTable('announcements_recipients', function (table) { + table.increments('id'); //autoincrementing (non-nullable) primary key + + table.integer('mid').notNullable() + .references('mid').inTable('messages_announcements') + .onDelete('CASCADE'); //if announcement is deleted, also delete recipients + + table.string('gid', 128).notNullable() + .references('gid').inTable('groups') + .onDelete('CASCADE'); //if group is deleted, also delete recipient + }); +}; + +exports.down = function (knex, Promise) { + return knex.schema.dropTable('announcements_recipients'); +}; diff --git a/db/migrations/20190202114347_create_events_authors.js b/db/migrations/20190202114347_create_events_authors.js new file mode 100644 index 0000000000000000000000000000000000000000..1619ccacf96cabe2725d4d92cce5bddc0099267c --- /dev/null +++ b/db/migrations/20190202114347_create_events_authors.js @@ -0,0 +1,18 @@ + +exports.up = function (knex, Promise) { + return knex.schema.createTable('events_authors', function (table) { + table.increments('id'); //autoincrementing (non-nullable) primary key + + table.integer('mid').notNullable() + .references('mid').inTable('messages_events') + .onDelete('CASCADE'); //if event is deleted, also delete authors + + table.string('gid', 128).notNullable() + .references('gid').inTable('groups') + .onDelete('CASCADE'); //if group is deleted, also delete authors + }); +}; + +exports.down = function (knex, Promise) { + return knex.schema.dropTable('events_authors'); +}; diff --git a/db/migrations/20190202114348_create_events_recipients.js b/db/migrations/20190202114348_create_events_recipients.js new file mode 100644 index 0000000000000000000000000000000000000000..fc8a157b18e50f7ac68d6a2334581e356d5c1b89 --- /dev/null +++ b/db/migrations/20190202114348_create_events_recipients.js @@ -0,0 +1,18 @@ + +exports.up = function (knex, Promise) { + return knex.schema.createTable('events_recipients', function (table) { + table.increments('id'); //autoincrementing (non-nullable) primary key + + table.integer('mid').notNullable() + .references('mid').inTable('messages_events') + .onDelete('CASCADE'); //if event is deleted, also delete recipients + + table.string('gid', 128).notNullable() + .references('gid').inTable('groups') + .onDelete('CASCADE'); //if group is deleted, also delete recipient + }); +}; + +exports.down = function (knex, Promise) { + return knex.schema.dropTable('events_recipients'); +}; diff --git a/src/graphql/typeDefs/objects.graphql b/src/graphql/typeDefs/objects.graphql index e304fe2b6b8d30ed3d48aaef354a513eb6bf3252..513143f09cb13d203e0cfcc98de3f2c8b61212c6 100644 --- a/src/graphql/typeDefs/objects.graphql +++ b/src/graphql/typeDefs/objects.graphql @@ -37,7 +37,7 @@ type User { # Pour le contacter mail: String phone: String - addresses: [String] # Adresse(s) de l'utilisateur (numero de casert par exemple) + address: String # Adresse de l'utilisateur (numero de casert par exemple) # Ses interactions avec des groupes memberOf: [Group] # Groupes dont l'utilisateur est membre @@ -139,7 +139,7 @@ type SimpleGroup implements Group { groupCoauthorEventRequestsToGroup: [GroupCoauthorEvent] # Graphe organique des groupes - parent: SimpleGroup # Groupe parent + parents: [SimpleGroup] # Groupe parent children: [SimpleGroup] # Groupes enfants memberOfMeta: [MetaGroup] visibilityEdges: [Group] # se rendre visible par des groupes en plus du graphe organique