style(db/models): run prettier on models/challenges directory

This commit is contained in:
parent e23faf84d4
commit f48ac551f4
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C
3 changed files with 71 additions and 55 deletions

@ -1,11 +1,10 @@
import mongoose, {Schema, PopulatedDoc, Document, Model} from "mongoose"; import mongoose, { Schema, PopulatedDoc, Document, Model } from "mongoose";
import { IUser } from "../../models/user"; import { IUser } from "~/models/user";
import SequenceFactory from "mongoose-sequence"; import SequenceFactory from "mongoose-sequence";
import { hasMigrated } from "../../lib/dbconfig"; import { hasMigrated } from "~/lib/dbconfig";
const AutoIncrement = SequenceFactory(mongoose); const AutoIncrement = SequenceFactory(mongoose);
export interface IBiffno { export interface IBiffno {
_id: number; _id: number;
title: string; title: string;
@ -13,56 +12,62 @@ export interface IBiffno {
excerpt: string; excerpt: string;
bands: number[]; bands: number[];
tags: string[]; tags: string[];
wordcount: number; words: number;
genre: string; genre: string;
cover: string; cover: string;
year: number; year: number;
author: PopulatedDoc<IUser & Document> author: PopulatedDoc<IUser & Document>;
} }
const biffnoschema = new mongoose.Schema<IBiffno>({ const biffnoschema = new mongoose.Schema<IBiffno>({
_id: { _id: {
type: Number type: Number,
}, },
title: { title: {
type: String, type: String,
default: "" default: "",
}, },
description: { description: {
type: String, type: String,
default: "" default: "",
}, },
excerpt: { excerpt: {
type: String, type: String,
default: "" default: "",
}, },
bands: [{ bands: [
{
type: Number, type: Number,
ref: "Band" ref: "Band",
}], },
tags: [{ ],
type: String tags: [
}], {
wordcount: { type: String,
},
],
words: {
type: Number, type: Number,
default: 0 default: 0,
}, },
genre: { genre: {
type: String type: String,
}, },
cover: { cover: {
type: String, type: String,
default: "" default: "",
}, },
year: { year: {
type: Number, type: Number,
default: 0 default: 0,
}, },
author: { author: {
type: Number, type: Number,
ref: "User" ref: "User",
} },
}); });
hasMigrated && biffnoschema.plugin(AutoIncrement, {start_seq: 1, id: "bif_id"}); hasMigrated &&
export const Biffno: Model<IBiffno> = /* mongoose.models.Biffno || */ mongoose.model('Biffno', biffnoschema, 'biffno'); 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 { IBand } from "~/models/band";
import { IUser } from "../../models/user"; import { IUser } from "~/models/user";
import SequenceFactory from "mongoose-sequence"; import SequenceFactory from "mongoose-sequence";
import { hasMigrated } from "../../lib/dbconfig"; import { hasMigrated } from "~/lib/dbconfig";
const AutoIncrement = SequenceFactory(mongoose); const AutoIncrement = SequenceFactory(mongoose);
@ -19,27 +25,30 @@ export interface IFicmas {
export const FicmasSchema = new mongoose.Schema<IFicmas>({ export const FicmasSchema = new mongoose.Schema<IFicmas>({
_id: { _id: {
type: Number type: Number,
}, },
kink: { kink: {
type: String type: String,
}, },
year: { type: String }, year: { type: String },
bands: [{ bands: [
{
type: Number, type: Number,
ref: "Band" ref: "Band",
}], },
],
relationship: { type: String }, relationship: { type: String },
wisher: { wisher: {
type: Number, type: Number,
ref: "User" ref: "User",
}, },
anniversary: { anniversary: {
type: Boolean, 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 SequenceFactory from "mongoose-sequence";
import { hasMigrated } from "../../lib/dbconfig"; import { hasMigrated } from "~/lib/dbconfig";
const AutoIncrement = SequenceFactory(mongoose); const AutoIncrement = SequenceFactory(mongoose);
@ -16,34 +16,36 @@ export interface IChallenge {
const challengeSchema = new mongoose.Schema<IChallenge>({ const challengeSchema = new mongoose.Schema<IChallenge>({
_id: { _id: {
type: Number type: Number,
}, },
name: { name: {
type: String, type: String,
required: true required: true,
}, },
description: { description: {
type: String, type: String,
required: true required: true,
}, },
deadline: { deadline: {
type: Date, type: Date,
required: true required: true,
}, },
active: { active: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
color: { color: {
type: String, type: String,
required: true, required: true,
default: `#${Math.floor(Math.random()*16777215).toString(16)}` default: `#${Math.floor(Math.random() * 16777215).toString(16)}`,
}, },
allowMultiple: { allowMultiple: {
type: Boolean, type: Boolean,
default: true default: true,
} },
}) });
hasMigrated && challengeSchema.plugin(AutoIncrement, {id: "challenges"}); hasMigrated && challengeSchema.plugin(AutoIncrement, { id: "challenges" });
export const Challenge: Model<IChallenge> = /* mongoose.models.Challenge || */ mongoose.model("Challenge", challengeSchema, "challenges") export const Challenge: Model<IChallenge> =
mongoose.models.Challenge ||
mongoose.model("Challenge", challengeSchema, "challenges");