wip
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
"scripts": {
|
||||
"build": "tsc --build"
|
||||
},
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./exports": "./dist/exports.js"
|
||||
},
|
||||
"author": "",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -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>;
|
||||
@@ -0,0 +1,9 @@
|
||||
export type {
|
||||
ServerActionType,
|
||||
UserIDType,
|
||||
IUser,
|
||||
} from "./schema/User.ts";
|
||||
|
||||
export type {
|
||||
ILoginToken
|
||||
} from "./schema/LoginToken.ts";
|
||||
@@ -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);
|
||||
@@ -17,7 +17,7 @@ const validGatewayActionTypeList = [
|
||||
|
||||
export type GatewayActionType = typeof validGatewayActionTypeList[number];
|
||||
|
||||
interface IUser {
|
||||
export interface IUser {
|
||||
_id: UserIDType;
|
||||
|
||||
oauthID?: bigint;
|
||||
|
||||
Reference in New Issue
Block a user