Initial auth library commmit

This commit is contained in:
2023-05-02 01:14:23 -04:00
parent a1d60a5042
commit 3411ae1234
17 changed files with 585 additions and 0 deletions

25
lib/schema/strategy.ts Normal file
View File

@@ -0,0 +1,25 @@
import { InferSchemaType, Schema, Types } from 'mongoose';
import { STRATEGIES } from '../constants/strategies';
export const Strategy = new Schema(
{
method: {
type: Number,
enum: Object.values(STRATEGIES),
index: true,
required: true,
unique: true,
},
externalId: { type: String, index: true },
key: { type: String, required: true, trim: true },
profile: {},
resetToken: { type: String },
forceReset: { type: Boolean },
},
{
minimize: true,
timestamps: true,
},
);
export type Strategy = InferSchemaType<typeof Strategy>;