Skip to content

Commit

Permalink
docs + guild model setup
Browse files Browse the repository at this point in the history
  • Loading branch information
vKxni committed Mar 18, 2024
1 parent 3172eda commit dcb18a9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/models/guild.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Schema, model } from "mongoose";

export interface IGuild {
guildID: string,
welcome_enabled: boolean,
welcome_channel: string,
welcome_join_role: string,
xp_enabled: boolean,
ignored_xp_channels: string[],
ignored_xp_roles: string[],
blacklisted_xp_users: string[],
inserted_at: Date,
updated_at: Date
}

const guildSchema = new Schema<IGuild>({
guildID: String,
welcome_enabled: Boolean,
welcome_channel: String,
welcome_join_role: String,
xp_enabled: Boolean,
ignored_xp_channels: [String],
ignored_xp_roles: [String],
blacklisted_xp_users: [String],
inserted_at: Date,
updated_at: Date
});

export default model<IGuild>('guilds', guildSchema);
8 changes: 7 additions & 1 deletion src/types/routes.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {Request, Response, NextFunction } from 'express';
import { Request, Response, NextFunction } from 'express';

/*
HttpMethod to have autocomplete for the HTTP methods
*/
type HttpMethod = 'get' | 'post' | 'put' | 'delete';

interface ParamsDictionary {
Expand All @@ -12,6 +15,9 @@ type ControllerFunction<T> = (
next: NextFunction
) => void;

/*
Object to define the route structure
*/
export type Route<T> = {
method: HttpMethod;
path: string;
Expand Down

0 comments on commit dcb18a9

Please sign in to comment.