This commit is contained in:
2023-09-23 13:24:37 +00:00
parent 9c9d9e9545
commit 438df6cd3c
60 changed files with 190 additions and 1100 deletions
+4
View File
@@ -6,6 +6,10 @@
"scripts": {
"build": "tsc --build"
},
"exports": {
".": "./dist/index.js",
"./exports": "./dist/exports.js"
},
"author": "",
"type": "module",
"license": "MIT",
-9
View File
@@ -1,9 +0,0 @@
import type { structure } from "../apiStructure/sammoGatewayAPI.js";
import type { APINamespaceType } from "./defs.js";
import { GetGameLoginToken } from "./GatewayAPI/GetGameLoginToken.js";
import { Login } from "./GatewayAPI/Login/index.js";
export const sammoGatewayAPI = {
Login,
GetGameLoginToken
} satisfies APINamespaceType<typeof structure>;
+9
View File
@@ -0,0 +1,9 @@
export type {
ServerActionType,
UserIDType,
IUser,
} from "./schema/User.ts";
export type {
ILoginToken
} from "./schema/LoginToken.ts";
+23
View File
@@ -0,0 +1,23 @@
import { type UserIDType } from "./User.js";
import { Mongoose, Schema, model } from "mongoose";
export interface ILoginToken {
userID: UserIDType;
token: string;
ip: string;
regDate: Date;
validUntil: Date;
}
export const LoginToken = new Schema<ILoginToken>({
userID: { type: Number, required: true },
token: { type: String, required: true },
ip: { type: String, required: true },
regDate: { type: Date, required: true },
validUntil: { type: Date, required: true },
}, { autoIndex: false, autoCreate: false, })
.index({ userID: 1, token: 1 })
.index({ validUntil: 1 }, { expireAfterSeconds: 1 })
;
export default (conn: Mongoose)=>conn.model<ILoginToken>('LoginToken', LoginToken);
@@ -0,0 +1,19 @@
import { Schema, model } from "mongoose";
export interface IServerVersion {
serverKey: string;
branch: string;
version: string;
updateDate: Date;
}
export const ServerVersion = new Schema<IServerVersion>({
serverKey: { type: String, required: true },
branch: { type: String, required: true },
version: { type: String, required: true },
updateDate: { type: Date, required: true },
}, { autoIndex: false, autoCreate: false, })
.index({ serverKey: 1 }, { unique: true })
;
export default model<IServerVersion>('ServerVersion', ServerVersion);
+1 -1
View File
@@ -17,7 +17,7 @@ const validGatewayActionTypeList = [
export type GatewayActionType = typeof validGatewayActionTypeList[number];
interface IUser {
export interface IUser {
_id: UserIDType;
oauthID?: bigint;