style(db/models): run prettier on models/challenges
directory
This commit is contained in:
parent
e23faf84d4
commit
f48ac551f4
@ -1,11 +1,10 @@
|
||||
import mongoose, {Schema, PopulatedDoc, Document, Model} from "mongoose";
|
||||
import { IUser } from "../../models/user";
|
||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||
import { IUser } from "~/models/user";
|
||||
import SequenceFactory from "mongoose-sequence";
|
||||
import { hasMigrated } from "../../lib/dbconfig";
|
||||
import { hasMigrated } from "~/lib/dbconfig";
|
||||
|
||||
const AutoIncrement = SequenceFactory(mongoose);
|
||||
|
||||
|
||||
export interface IBiffno {
|
||||
_id: number;
|
||||
title: string;
|
||||
@ -13,56 +12,62 @@ export interface IBiffno {
|
||||
excerpt: string;
|
||||
bands: number[];
|
||||
tags: string[];
|
||||
wordcount: number;
|
||||
words: number;
|
||||
genre: string;
|
||||
cover: string;
|
||||
year: number;
|
||||
author: PopulatedDoc<IUser & Document>
|
||||
author: PopulatedDoc<IUser & Document>;
|
||||
}
|
||||
|
||||
const biffnoschema = new mongoose.Schema<IBiffno>({
|
||||
_id: {
|
||||
type: Number
|
||||
type: Number,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: "",
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: "",
|
||||
},
|
||||
excerpt: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: "",
|
||||
},
|
||||
bands: [{
|
||||
bands: [
|
||||
{
|
||||
type: Number,
|
||||
ref: "Band"
|
||||
}],
|
||||
tags: [{
|
||||
type: String
|
||||
}],
|
||||
wordcount: {
|
||||
ref: "Band",
|
||||
},
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
type: String,
|
||||
},
|
||||
],
|
||||
words: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
genre: {
|
||||
type: String
|
||||
type: String,
|
||||
},
|
||||
cover: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: "",
|
||||
},
|
||||
year: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
author: {
|
||||
type: Number,
|
||||
ref: "User"
|
||||
}
|
||||
ref: "User",
|
||||
},
|
||||
});
|
||||
|
||||
hasMigrated && biffnoschema.plugin(AutoIncrement, {start_seq: 1, id: "bif_id"});
|
||||
export const Biffno: Model<IBiffno> = /* mongoose.models.Biffno || */ mongoose.model('Biffno', biffnoschema, 'biffno');
|
||||
hasMigrated &&
|
||||
biffnoschema.plugin(AutoIncrement, { start_seq: 1, id: "bif_id" });
|
||||
export const Biffno: Model<IBiffno> =
|
||||
mongoose.models.Biffno || mongoose.model("Biffno", biffnoschema, "biffno");
|
||||
|
@ -1,9 +1,15 @@
|
||||
import mongoose, {Schema, PopulatedDoc, Document, Model, model} from "mongoose";
|
||||
import mongoose, {
|
||||
Schema,
|
||||
PopulatedDoc,
|
||||
Document,
|
||||
Model,
|
||||
model,
|
||||
} from "mongoose";
|
||||
|
||||
import { IBand } from "../../models/band";
|
||||
import { IUser } from "../../models/user";
|
||||
import { IBand } from "~/models/band";
|
||||
import { IUser } from "~/models/user";
|
||||
import SequenceFactory from "mongoose-sequence";
|
||||
import { hasMigrated } from "../../lib/dbconfig";
|
||||
import { hasMigrated } from "~/lib/dbconfig";
|
||||
|
||||
const AutoIncrement = SequenceFactory(mongoose);
|
||||
|
||||
@ -19,27 +25,30 @@ export interface IFicmas {
|
||||
|
||||
export const FicmasSchema = new mongoose.Schema<IFicmas>({
|
||||
_id: {
|
||||
type: Number
|
||||
type: Number,
|
||||
},
|
||||
kink: {
|
||||
type: String
|
||||
type: String,
|
||||
},
|
||||
year: { type: String },
|
||||
bands: [{
|
||||
bands: [
|
||||
{
|
||||
type: Number,
|
||||
ref: "Band"
|
||||
}],
|
||||
ref: "Band",
|
||||
},
|
||||
],
|
||||
relationship: { type: String },
|
||||
wisher: {
|
||||
type: Number,
|
||||
ref: "User"
|
||||
ref: "User",
|
||||
},
|
||||
anniversary: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
hasMigrated && FicmasSchema.plugin(AutoIncrement, {id: "ficmas_wishes"})
|
||||
hasMigrated && FicmasSchema.plugin(AutoIncrement, { id: "ficmas_wishes" });
|
||||
|
||||
export const Ficmas: Model<IFicmas> = /* mongoose.models.Ficmas || */ model("Ficmas", FicmasSchema, "ficmas_wishes")
|
||||
export const Ficmas: Model<IFicmas> =
|
||||
mongoose.models.Ficmas || model("Ficmas", FicmasSchema, "ficmas_wishes");
|
||||
|
@ -1,6 +1,6 @@
|
||||
import mongoose, {Schema, PopulatedDoc, Document, Model} from "mongoose";
|
||||
import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
|
||||
import SequenceFactory from "mongoose-sequence";
|
||||
import { hasMigrated } from "../../lib/dbconfig";
|
||||
import { hasMigrated } from "~/lib/dbconfig";
|
||||
|
||||
const AutoIncrement = SequenceFactory(mongoose);
|
||||
|
||||
@ -16,34 +16,36 @@ export interface IChallenge {
|
||||
|
||||
const challengeSchema = new mongoose.Schema<IChallenge>({
|
||||
_id: {
|
||||
type: Number
|
||||
type: Number,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
deadline: {
|
||||
type: Date,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: `#${Math.floor(Math.random()*16777215).toString(16)}`
|
||||
default: `#${Math.floor(Math.random() * 16777215).toString(16)}`,
|
||||
},
|
||||
allowMultiple: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
hasMigrated && challengeSchema.plugin(AutoIncrement, {id: "challenges"});
|
||||
export const Challenge: Model<IChallenge> = /* mongoose.models.Challenge || */ mongoose.model("Challenge", challengeSchema, "challenges")
|
||||
hasMigrated && challengeSchema.plugin(AutoIncrement, { id: "challenges" });
|
||||
export const Challenge: Model<IChallenge> =
|
||||
mongoose.models.Challenge ||
|
||||
mongoose.model("Challenge", challengeSchema, "challenges");
|
||||
|
Loading…
Reference in New Issue
Block a user