mirror of
https://github.com/wassname/talk.git
synced 2026-08-18 12:30:39 +08:00
replaced eslint:recommended with prettier
This commit is contained in:
+38
-33
@@ -8,46 +8,51 @@ const USER_ROLES = require('../enum/user_roles');
|
||||
* The Mongo schema for a Tag.
|
||||
* @type {Schema}
|
||||
*/
|
||||
const TagSchema = new Schema({
|
||||
const TagSchema = new Schema(
|
||||
{
|
||||
// The actual name of the tag.
|
||||
name: String,
|
||||
|
||||
// The actual name of the tag.
|
||||
name: String,
|
||||
// Contains permission data.
|
||||
permissions: {
|
||||
// Determines if this tag is public or not.
|
||||
public: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
|
||||
// Contains permission data.
|
||||
permissions: {
|
||||
// Determines if the owner of the Model can add/remove this tag on their own
|
||||
// resources.
|
||||
self: Boolean,
|
||||
|
||||
// Determines if this tag is public or not.
|
||||
public: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
// Determines other roles that are allowed to set this tag on other
|
||||
// resources.
|
||||
roles: [
|
||||
{
|
||||
type: String,
|
||||
enum: USER_ROLES,
|
||||
default: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// Determines if the owner of the Model can add/remove this tag on their own
|
||||
// resources.
|
||||
self: Boolean,
|
||||
// A list of all the model types that this tag can be added to.
|
||||
models: [
|
||||
{
|
||||
type: String,
|
||||
enum: ITEM_TYPES,
|
||||
},
|
||||
],
|
||||
|
||||
// Determines other roles that are allowed to set this tag on other
|
||||
// resources.
|
||||
roles: [{
|
||||
type: String,
|
||||
enum: USER_ROLES,
|
||||
default: []
|
||||
}]
|
||||
// The date for when the tag was created.
|
||||
created_at: {
|
||||
type: Date,
|
||||
default: Date,
|
||||
},
|
||||
},
|
||||
|
||||
// A list of all the model types that this tag can be added to.
|
||||
models: [{
|
||||
type: String,
|
||||
enum: ITEM_TYPES
|
||||
}],
|
||||
|
||||
// The date for when the tag was created.
|
||||
created_at: {
|
||||
type: Date,
|
||||
default: Date
|
||||
{
|
||||
_id: false,
|
||||
}
|
||||
}, {
|
||||
_id: false
|
||||
});
|
||||
);
|
||||
|
||||
module.exports = TagSchema;
|
||||
|
||||
+19
-17
@@ -6,26 +6,28 @@ const TagSchema = require('./tag');
|
||||
* The Mongo schema for linking a Tag to a Model.
|
||||
* @type {Schema}
|
||||
*/
|
||||
const TagLinkSchema = new Schema({
|
||||
const TagLinkSchema = new Schema(
|
||||
{
|
||||
// A deep copy of the tag that is the origin for this link. If the ID matches
|
||||
// with existing tags in the global/asset context then content will be
|
||||
// substituted.
|
||||
tag: TagSchema,
|
||||
|
||||
// A deep copy of the tag that is the origin for this link. If the ID matches
|
||||
// with existing tags in the global/asset context then content will be
|
||||
// substituted.
|
||||
tag: TagSchema,
|
||||
// The User ID of the user that assigned the status.
|
||||
assigned_by: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
|
||||
// The User ID of the user that assigned the status.
|
||||
assigned_by: {
|
||||
type: String,
|
||||
default: null
|
||||
// The date when the tag was added to the model.
|
||||
created_at: {
|
||||
type: Date,
|
||||
default: Date,
|
||||
},
|
||||
},
|
||||
|
||||
// The date when the tag was added to the model.
|
||||
created_at: {
|
||||
type: Date,
|
||||
default: Date
|
||||
{
|
||||
_id: false,
|
||||
}
|
||||
}, {
|
||||
_id: false
|
||||
});
|
||||
);
|
||||
|
||||
module.exports = TagLinkSchema;
|
||||
|
||||
@@ -2,7 +2,6 @@ const mongoose = require('../../services/mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const TokenSchema = new Schema({
|
||||
|
||||
// ID is the JTI of a given JWT's identifier.
|
||||
id: String,
|
||||
|
||||
@@ -10,7 +9,7 @@ const TokenSchema = new Schema({
|
||||
name: String,
|
||||
|
||||
// Active is used to determine if the token is valid.
|
||||
active: Boolean
|
||||
active: Boolean,
|
||||
});
|
||||
|
||||
module.exports = TokenSchema;
|
||||
|
||||
Reference in New Issue
Block a user