feat(news): Add news model

This commit is contained in:
Mrugesh Mohapatra
2018-07-31 00:28:36 +05:30
committed by mrugesh mohapatra
parent f46f06ccd6
commit eba910e939
7 changed files with 103 additions and 17 deletions

5
common/models/article.js Normal file
View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function(Article) {
};

View File

@@ -0,0 +1,74 @@
{
"name": "article",
"plural": "articles",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"shortId": {
"type": "string",
"required": true
},
"title": {
"type": "string",
"required": true
},
"author": {
"type": "string",
"required": true
},
"subtitle": {
"type": "string"
},
"featureImage": {
"type": "string"
},
"draft": {
"type": "string",
"required": true
},
"renderableContent": {
"type": "string"
},
"published": {
"type": "boolean",
"required": true,
"default": false
},
"featured": {
"type": "boolean",
"required": true,
"default": false
},
"underReview": {
"type": "boolean",
"required": true,
"default": false
},
"viewCount": {
"type": "number",
"required": true,
"default": 1
},
"createdDate": {
"type": "date",
"required": true
},
"lastEditedDate": {
"type": "date",
"required": true
},
"history": {
"type": [
"object"
],
"required": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}

View File

@@ -92,7 +92,7 @@
"type": "array", "type": "array",
"default": [] "default": []
}, },
"guideUrl" : { "guideUrl": {
"type": "string", "type": "string",
"description": "Used to link to an article in the FCC guide" "description": "Used to link to an article in the FCC guide"
}, },

View File

@@ -244,19 +244,23 @@
}, },
"default": {} "default": {}
}, },
"donationEmails": [ "string" ], "donationEmails": {
"type": [
"string"
]
},
"isDonating": { "isDonating": {
"type": "boolean", "type": "boolean",
"default": false, "description": "Does the camper have an active donation",
"description": "Does the camper have an active donation" "default": false
} }
}, },
"validations": [], "validations": [],
"relations": { "relations": {
"donations": { "donations": {
"type": "hasMany", "type": "hasMany",
"modal": "donation", "foreignKey": "",
"foreignKey": "" "modal": "donation"
}, },
"credentials": { "credentials": {
"type": "hasMany", "type": "hasMany",

View File

@@ -41,7 +41,6 @@
} }
}, },
"method-override": {} "method-override": {}
}, },
"parse:after": { "parse:after": {
"./middlewares/validator": {} "./middlewares/validator": {}

View File

@@ -86,5 +86,9 @@
"User": { "User": {
"dataSource": "db", "dataSource": "db",
"public": false "public": false
},
"article": {
"dataSource": "db",
"public": true
} }
} }

View File

@@ -1,12 +1,17 @@
{ {
"name": "Donation", "name": "Donation",
"plural": "donations",
"description": "A representaion of a donation to freeCodeCamp", "description": "A representaion of a donation to freeCodeCamp",
"plural": "donations",
"base": "PersistedModel", "base": "PersistedModel",
"idInjection": true, "idInjection": true,
"scopes": {},
"indexes": {},
"options": { "options": {
"validateUpsert": true "validateUpsert": true
}, },
"hidden": [],
"remoting": {},
"http": {},
"properties": { "properties": {
"email": { "email": {
"type": "string", "type": "string",
@@ -41,14 +46,14 @@
"description": "The providers reference for the donator" "description": "The providers reference for the donator"
} }
}, },
"hidden": [],
"validations": [ "validations": [
{ {
"amount": { "amount": {
"type": "number", "type": "number",
"description": "Amount should be >= $1 (100c)", "description": "Amount should be >= $1 (100c)",
"min": 100 "min": 100
} },
"facetName": "server"
} }
], ],
"relations": { "relations": {
@@ -59,10 +64,5 @@
} }
}, },
"acls": [], "acls": [],
"scopes": {}, "methods": {}
"indexes" : {},
"methods": [],
"remoting": {},
"http": {}
} }