Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import shopRouter from "./services/shop/shop-router";
import staffRouter from "./services/staff/staff-router";
import versionRouter from "./services/version/version-router";
import userRouter from "./services/user/user-router";
import projectRouter from "./services/project/project-router";

// import { InitializeConfigReader } from "./middleware/config-reader";
import { ErrorHandler } from "./middleware/error-handler";
Expand Down Expand Up @@ -64,6 +65,7 @@ app.use("/shop/", database, shopRouter);
app.use("/staff/", database, staffRouter);
app.use("/version/", versionRouter);
app.use("/user/", database, userRouter);
app.use("/project/", database, projectRouter);

// Docs
app.use("/docs/json", async (_req, res) => res.json(await getOpenAPISpec()));
Expand Down
1 change: 1 addition & 0 deletions src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const Config = {
SHOP_ID_LENGTH: 2 * 2,
EVENT_ID_LENGTH: 2 * 16,
MAX_SHOP_STOCK_PER_ITEM: 128,
TEAM_SIZE: 4,

RANKING_OFFSET: 1,
};
Expand Down
11 changes: 11 additions & 0 deletions src/common/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { UserAttendance, UserFollowing, UserInfo } from "../services/user/user-s
import { AnyParamConstructor, IModelOptions } from "@typegoose/typegoose/lib/types";
import { StaffShift } from "../services/staff/staff-schemas";
import { NotificationMappings, NotificationMessages } from "../services/notification/notification-schemas";
import { Project, ProjectMappings } from "../services/project/project-schema";
import { PuzzleItem, PuzzleAnswer } from "../services/puzzle/puzzle-schemas";

// Groups for collections
Expand All @@ -24,6 +25,7 @@ export enum Group {
MENTOR = "mentor",
NEWSLETTER = "newsletter",
NOTIFICATION = "notification",
PROJECT = "project",
PUZZLE = "puzzle",
REGISTRATION = "registration",
SHOP = "shop",
Expand Down Expand Up @@ -88,6 +90,11 @@ enum UserCollection {
FOLLOWING = "following",
}

enum ProjectCollection {
PROJECTS = "projects",
MAPPINGS = "mappings",
}

export function generateConfig(collection: string): IModelOptions {
return {
schemaOptions: { collection: collection, versionKey: false },
Expand Down Expand Up @@ -143,6 +150,10 @@ export default class Models {
NotificationCollection.MESSAGES,
);

// Projects
static ProjectProjects: Model<Project> = getModel(Project, Group.PROJECT, ProjectCollection.PROJECTS);
static ProjectMappings: Model<ProjectMappings> = getModel(ProjectMappings, Group.PROJECT, ProjectCollection.MAPPINGS);

// Puzzle
static PuzzleItem: Model<PuzzleItem> = getModel(PuzzleItem, Group.PUZZLE, PuzzleCollection.RUNES_AND_RIDDLES);
static PuzzleAnswer: Model<PuzzleAnswer> = getModel(PuzzleAnswer, Group.PUZZLE, PuzzleCollection.ANSWERS);
Expand Down
1 change: 1 addition & 0 deletions src/middleware/specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export enum Tag {
NEWSLETTER = "Newsletter",
NOTIFICATION = "Notification",
PROFILE = "Profile",
PROJECT = "Project",
PUZZLE = "Puzzle",
REGISTRATION = "Registration",
S3 = "S3",
Expand Down
Loading