Skip to content

Commit 7bc6500

Browse files
committed
cleanup
1 parent 53f38ce commit 7bc6500

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

server/bird/bird.api.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = async waw => {
2+
// add your router code
3+
};

server/bird/bird.collection.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module.exports = async function (waw) {
2+
const Schema = waw.mongoose.Schema({
3+
name: String,
4+
description: String,
5+
url: { type: String, sparse: true, trim: true, unique: true },
6+
data: {},
7+
author: {
8+
type: waw.mongoose.Schema.Types.ObjectId,
9+
ref: "User",
10+
},
11+
moderators: [
12+
{
13+
type: waw.mongoose.Schema.Types.ObjectId,
14+
sparse: true,
15+
ref: "User",
16+
},
17+
],
18+
});
19+
20+
Schema.methods.create = function (obj, user, waw) {
21+
this.author = user._id;
22+
23+
this.moderators = [user._id];
24+
25+
this.name = obj.name;
26+
27+
this.description = obj.description;
28+
29+
this.data = obj.data;
30+
31+
this.url = obj.url;
32+
};
33+
return (waw.Bird = waw.mongoose.model("Bird", Schema));
34+
};

server/bird/module.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "Bird",
3+
"crud": {
4+
"unique": [ "url" ],
5+
"update": {
6+
"keys": ["name", "description", "data"]
7+
},
8+
"delete": [""]
9+
},
10+
"dependencies": {}
11+
}

0 commit comments

Comments
 (0)