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",
"default": []
},
"guideUrl" : {
"guideUrl": {
"type": "string",
"description": "Used to link to an article in the FCC guide"
},

View File

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

View File

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

View File

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

View File

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