BOSS 2.0 - Full TS and microservice rewrite. Still pulls from local until admin panel updates

This commit is contained in:
Jonathan Barrow
2023-08-25 21:11:44 -04:00
parent 8daf7ef041
commit 335439db7d
32 changed files with 6051 additions and 107 deletions

31
src/models/file.ts Normal file
View File

@@ -0,0 +1,31 @@
import mongoose from 'mongoose';
import { AutoIncrementID } from '@typegoose/auto-increment';
import { IFile, IFileMethods, FileModel } from '@/types/mongoose/file';
const FileSchema = new mongoose.Schema<IFile, FileModel, IFileMethods>({
deleted: {
type: Boolean,
default: false
},
data_id: Number, // TODO - Wait until https://github.com/typegoose/auto-increment/pull/21 is merged and then change this to BigInt
task_id: String,
boss_app_id: String,
supported_countries: [String],
supported_languages: [String],
creator_pid: Number,
name: String,
type: String,
hash: String,
size: BigInt,
notify_on_new: [String],
notify_led: Boolean,
created: BigInt,
updated: BigInt
}, { id: false });
FileSchema.plugin(AutoIncrementID, {
startAt: 50000, // * Start very high to avoid conflicts with Nintendo Data IDs
field: 'data_id'
});
export const File: FileModel = mongoose.model<IFile, FileModel>('File', FileSchema);

22
src/models/task.ts Normal file
View File

@@ -0,0 +1,22 @@
import mongoose from 'mongoose';
import { ITask, ITaskMethods, TaskModel } from '@/types/mongoose/task';
const TaskSchema = new mongoose.Schema<ITask, TaskModel, ITaskMethods>({
deleted: {
type: Boolean,
default: false
},
id: String,
boss_app_id: String,
creator_pid: Number,
status: {
type: String,
enum : ['open'] // TODO - What else is there?
},
title_id: String,
description: Number,
created: BigInt,
updated: BigInt
}, { id: false });
export const Task: TaskModel = mongoose.model<ITask, TaskModel>('Task', TaskSchema);