mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
start upgrading eslint
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import mongoose from 'mongoose';
|
||||
import baseModel from '../libs/baseModel';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import validator from 'validator';
|
||||
import _ from 'lodash';
|
||||
import baseModel from '../libs/baseModel';
|
||||
|
||||
const NOTIFICATION_TYPES = [
|
||||
'DROPS_ENABLED',
|
||||
@@ -42,9 +42,9 @@ const NOTIFICATION_TYPES = [
|
||||
'ACHIEVEMENT_ARID_AUTHORITY',
|
||||
];
|
||||
|
||||
const Schema = mongoose.Schema;
|
||||
const { Schema } = mongoose;
|
||||
|
||||
export let schema = new Schema({
|
||||
export const schema = new Schema({
|
||||
id: {
|
||||
$type: String,
|
||||
default: uuid,
|
||||
@@ -60,9 +60,10 @@ export let schema = new Schema({
|
||||
// required: true,
|
||||
enum: NOTIFICATION_TYPES,
|
||||
},
|
||||
data: {$type: Schema.Types.Mixed, default: () => {
|
||||
return {};
|
||||
}},
|
||||
data: {
|
||||
$type: Schema.Types.Mixed,
|
||||
default: () => ({}),
|
||||
},
|
||||
// A field to mark the notification as seen without deleting it, optional use
|
||||
seen: {
|
||||
$type: Boolean,
|
||||
@@ -100,9 +101,7 @@ schema.statics.convertNotificationsToSafeJson = function convertNotificationsToS
|
||||
return false;
|
||||
});
|
||||
|
||||
return filteredNotifications.map(n => {
|
||||
return n.toJSON();
|
||||
});
|
||||
return filteredNotifications.map(n => n.toJSON());
|
||||
};
|
||||
|
||||
schema.plugin(baseModel, {
|
||||
@@ -111,4 +110,4 @@ schema.plugin(baseModel, {
|
||||
_id: false, // use id instead of _id
|
||||
});
|
||||
|
||||
export let model = mongoose.model('UserNotification', schema);
|
||||
export const model = mongoose.model('UserNotification', schema);
|
||||
|
||||
Reference in New Issue
Block a user