I have a user account and a post model but I want authenticated users to comment on a Post.
user_account model
{
"name": "user_account",
"base": "User",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"firstname": {
"type": "string"
},
"lastname": {
"type": "string"
},
"school": {
"type": "string"
},
"gender": {
"type": "string"
},
"email": {
"type": "string"
},
"about": {
"type": "string"
},
"title": {
"type": "string"
},
"personal_info": {
"type": "string"
},
"relationship_status": {
"type": "string"
},
"fraternity": {
"type": "string"
},
"favorite_bar": {
"type": "string"
},
"birth_date": {
"type": "string"
}
},
"validations": [],
"relations": {
"general-posts": {
"type": "hasMany",
"model": "general-posts",
"foreignKey": ""
}
},
"acls": [
{
"principalType": "ROLE",
"principalId": "$owner",
"permission": "ALLOW",
"property": [
"__get__general-posts",
"__delete__general-posts",
"__destroyById__general-posts",
"__findById__general-posts",
"__updateById__general-posts",
"__create__general-posts"
]
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
],
"methods": {}
}
general_post model
{
"name": "general-posts",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"username": {
"type": "string",
"required": false
},
"school": {
"type": "string",
"required": false
},
"content": {
"type": "string",
"required": false
},
"likes": {
"type": "number",
"required": false
}
},
"validations": [],
"relations": {},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
},
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
}
],
"methods": {}
}
How should i design my model for user comment? How do I make users post comment and have their names on comment without getting their name from the localstorage(frontend)? What relation and ACL should i use?
via Nafis Hasnian Rafi
No comments:
Post a Comment