revert(db/models): revert guard removal
we need it after all lmao
This commit is contained in:
parent
f611c56c39
commit
1412d39240
@ -30,7 +30,9 @@ const BandSchema = new mongoose.Schema<IBand>({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
hasMigrated && BandSchema.plugin(AutoIncrement, { id: "band" });
|
hasMigrated &&
|
||||||
|
!mongoose.models.Band &&
|
||||||
|
BandSchema.plugin(AutoIncrement, { id: "band" });
|
||||||
export const Band: Model<IBand> = /* mongoose.models.Band || */ model<IBand>(
|
export const Band: Model<IBand> = /* mongoose.models.Band || */ model<IBand>(
|
||||||
"Band",
|
"Band",
|
||||||
BandSchema,
|
BandSchema,
|
||||||
|
@ -68,6 +68,7 @@ const biffnoschema = new mongoose.Schema<IBiffno>({
|
|||||||
});
|
});
|
||||||
|
|
||||||
hasMigrated &&
|
hasMigrated &&
|
||||||
|
!mongoose.models.Biffno &&
|
||||||
biffnoschema.plugin(AutoIncrement, { start_seq: 1, id: "bif_id" });
|
biffnoschema.plugin(AutoIncrement, { start_seq: 1, id: "bif_id" });
|
||||||
export const Biffno: Model<IBiffno> =
|
export const Biffno: Model<IBiffno> =
|
||||||
mongoose.models.Biffno || mongoose.model("Biffno", biffnoschema, "biffno");
|
mongoose.models.Biffno || mongoose.model("Biffno", biffnoschema, "biffno");
|
||||||
|
@ -49,6 +49,7 @@ export const FicmasSchema = new mongoose.Schema<IFicmas>({
|
|||||||
});
|
});
|
||||||
|
|
||||||
hasMigrated &&
|
hasMigrated &&
|
||||||
|
!mongoose.models.Ficmas &&
|
||||||
FicmasSchema.plugin(AutoIncrement, { id: "ficmas_wishes", inc_field: "_id" });
|
FicmasSchema.plugin(AutoIncrement, { id: "ficmas_wishes", inc_field: "_id" });
|
||||||
|
|
||||||
export const Ficmas: Model<IFicmas> =
|
export const Ficmas: Model<IFicmas> =
|
||||||
|
@ -45,7 +45,9 @@ const challengeSchema = new mongoose.Schema<IChallenge>({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
hasMigrated && challengeSchema.plugin(AutoIncrement, { id: "challenges" });
|
hasMigrated &&
|
||||||
|
!mongoose.models.Challenge &&
|
||||||
|
challengeSchema.plugin(AutoIncrement, { id: "challenges" });
|
||||||
export const Challenge: Model<IChallenge> =
|
export const Challenge: Model<IChallenge> =
|
||||||
// mongoose.models.Challenge ||
|
// mongoose.models.Challenge ||
|
||||||
mongoose.model("Challenge", challengeSchema, "challenges");
|
mongoose.model("Challenge", challengeSchema, "challenges");
|
||||||
|
@ -50,7 +50,9 @@ const PMSchema = new mongoose.Schema<IPrivMsg>({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
hasMigrated && PMSchema.plugin(AutoIncrement, { id: "private_message" });
|
hasMigrated &&
|
||||||
|
!mongoose.models.PrivMsg &&
|
||||||
|
PMSchema.plugin(AutoIncrement, { id: "private_message" });
|
||||||
|
|
||||||
export const PrivMsg: Model<IPrivMsg> =
|
export const PrivMsg: Model<IPrivMsg> =
|
||||||
/* mongoose.models.PrivMsg || */ mongoose.model(
|
/* mongoose.models.PrivMsg || */ mongoose.model(
|
||||||
|
@ -39,7 +39,9 @@ const DraftSchema = new Schema<IDraft>(
|
|||||||
{ timestamps: true },
|
{ timestamps: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
hasMigrated && DraftSchema.plugin(AutoIncrement, { id: "drafts" });
|
hasMigrated &&
|
||||||
|
!mongoose.models.Draft &&
|
||||||
|
DraftSchema.plugin(AutoIncrement, { id: "drafts" });
|
||||||
|
|
||||||
export const Draft: Model<IDraft> =
|
export const Draft: Model<IDraft> =
|
||||||
/* mongoose.models.Draft || */ mongoose.model("Draft", DraftSchema, "drafts");
|
/* mongoose.models.Draft || */ mongoose.model("Draft", DraftSchema, "drafts");
|
||||||
|
@ -88,6 +88,7 @@ const StorySchema = new mongoose.Schema<IStory>({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
hasMigrated &&
|
hasMigrated &&
|
||||||
|
!mongoose.models.Story &&
|
||||||
Chapter.plugin(AutoIncrement, { id: "chapterid", inc_field: "id" });
|
Chapter.plugin(AutoIncrement, { id: "chapterid", inc_field: "id" });
|
||||||
hasMigrated && StorySchema.plugin(AutoIncrement, { id: "storyid" });
|
hasMigrated && StorySchema.plugin(AutoIncrement, { id: "storyid" });
|
||||||
export const Story: Model<IStory> =
|
export const Story: Model<IStory> =
|
||||||
|
@ -72,7 +72,9 @@ CommentSchema
|
|||||||
populateSelected("author", "User", "profile username _id blocked"),
|
populateSelected("author", "User", "profile username _id blocked"),
|
||||||
);
|
);
|
||||||
|
|
||||||
hasMigrated && CommentSchema.plugin(AutoIncrement, { id: "reviews" });
|
hasMigrated &&
|
||||||
|
!mongoose.models.Review &&
|
||||||
|
CommentSchema.plugin(AutoIncrement, { id: "reviews" });
|
||||||
|
|
||||||
export const Review: Model<IReview> =
|
export const Review: Model<IReview> =
|
||||||
/* mongoose.models.Review || */ mongoose.model(
|
/* mongoose.models.Review || */ mongoose.model(
|
||||||
|
@ -293,5 +293,6 @@ UserSchema.methods.generateJWT = function (jwtKey: string): string {
|
|||||||
};
|
};
|
||||||
|
|
||||||
hasMigrated &&
|
hasMigrated &&
|
||||||
|
!mongoose.models.User &&
|
||||||
UserSchema.plugin(AutoIncrement, { id: "userid", inc_field: "_id" });
|
UserSchema.plugin(AutoIncrement, { id: "userid", inc_field: "_id" });
|
||||||
export const User = mongoose.model<IUser, UModel>("User", UserSchema, "users");
|
export const User = mongoose.model<IUser, UModel>("User", UserSchema, "users");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user