summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/events/event.model.js6
-rw-r--r--services/events/event.schema.js16
-rw-r--r--services/events/event.service.js7
-rw-r--r--services/index.js10
-rw-r--r--services/users/user.model.js6
-rw-r--r--services/users/user.schema.js14
-rw-r--r--services/users/user.service.js7
7 files changed, 66 insertions, 0 deletions
diff --git a/services/events/event.model.js b/services/events/event.model.js
new file mode 100644
index 0000000..7bac9d5
--- /dev/null
+++ b/services/events/event.model.js
@@ -0,0 +1,6 @@
+const { model } = require('mongoose');
+const eventSchema = require('./event.schema.js');
+
+module.exports = model('Event', eventSchema);
+
+
diff --git a/services/events/event.schema.js b/services/events/event.schema.js
new file mode 100644
index 0000000..555153b
--- /dev/null
+++ b/services/events/event.schema.js
@@ -0,0 +1,16 @@
+const { Schema, Types } = require('mongoose');
+
+module.exports = new Schema({
+ startDate: {
+ type: Date,
+ required: true
+ },
+ endDate: {
+ type: Date,
+ required: true
+ },
+ attendanceId: Number,
+ conferenceId: Number,
+ participantIds: [Types.ObjectId]
+}, { timestamps: true });
+
diff --git a/services/events/event.service.js b/services/events/event.service.js
new file mode 100644
index 0000000..e9e7e50
--- /dev/null
+++ b/services/events/event.service.js
@@ -0,0 +1,7 @@
+const service = require('feathers-mongoose');
+const Model = require('./event.model.js');
+
+const EventService = service({ Model })
+
+module.exports = app => app.use('/events', EventService);
+
diff --git a/services/index.js b/services/index.js
new file mode 100644
index 0000000..f2d65d0
--- /dev/null
+++ b/services/index.js
@@ -0,0 +1,10 @@
+const Users = require('./users/user.service.js');
+const Events = require('./events/event.service.js');
+
+module.exports = app => {
+ app.configure(Users);
+ app.configure(Events);
+
+ app.get('/ping', (req, res) => res.send('pong'));
+};
+
diff --git a/services/users/user.model.js b/services/users/user.model.js
new file mode 100644
index 0000000..74a83ae
--- /dev/null
+++ b/services/users/user.model.js
@@ -0,0 +1,6 @@
+const { model } = require('mongoose');
+const userSchema = require('./user.schema.js');
+
+module.exports = model('User', userSchema);
+
+
diff --git a/services/users/user.schema.js b/services/users/user.schema.js
new file mode 100644
index 0000000..f2c98ef
--- /dev/null
+++ b/services/users/user.schema.js
@@ -0,0 +1,14 @@
+const { Schema } = require('mongoose');
+
+module.exports = new Schema({
+ username: {
+ type: String,
+ unique: true,
+ required: true
+ },
+ password: {
+ type: String,
+ required: true
+ }
+}, { timestamps: true });
+
diff --git a/services/users/user.service.js b/services/users/user.service.js
new file mode 100644
index 0000000..67f2ae6
--- /dev/null
+++ b/services/users/user.service.js
@@ -0,0 +1,7 @@
+const service = require('feathers-mongoose');
+const Model = require('./user.model.js');
+
+const UserService = service({ Model })
+
+module.exports = app => app.use('/users', UserService);
+