Ocelot-Social/backend/src/models/Notification.js
Wolfgang Huß 83a538d345 Write backend tests
Rename files.

Co-Authored-By: mattwr18 <mattwr18@gmail.com>
2019-08-19 22:13:42 +02:00

36 lines
656 B
JavaScript

import uuid from 'uuid/v4'
module.exports = {
id: {
type: 'uuid',
primary: true,
default: uuid,
},
read: {
type: 'boolean',
default: false,
},
reason: {
type: 'string',
valid: ['mentioned_in_post', 'mentioned_in_comment', 'comment_on_your_post'],
default: 'mentioned_in_post',
},
createdAt: {
type: 'string',
isoDate: true,
default: () => new Date().toISOString(),
},
user: {
type: 'relationship',
relationship: 'NOTIFIED',
target: 'User',
direction: 'out',
},
post: {
type: 'relationship',
relationship: 'NOTIFIED',
target: 'Post',
direction: 'in',
},
}