diff options
| author | Raphael Kabo <raphaelkabo@hey.com> | 2024-02-25 17:56:25 +0000 | 
|---|---|---|
| committer | Raphael Kabo <raphaelkabo@hey.com> | 2024-02-25 17:56:25 +0000 | 
| commit | cd0f291eb1a608589fcc2c1875fa7099ed8e2c51 (patch) | |
| tree | 05b1d8b1d63baed174883cc96807051e530969a2 /src/models | |
| parent | b17238eb2840553c69fc2dae168be557afbcee9c (diff) | |
feat: optionally restrict event creation to specific emails
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/MagicLink.ts | 35 | 
1 files changed, 35 insertions, 0 deletions
diff --git a/src/models/MagicLink.ts b/src/models/MagicLink.ts new file mode 100644 index 0000000..fa24c33 --- /dev/null +++ b/src/models/MagicLink.ts @@ -0,0 +1,35 @@ +import mongoose from "mongoose"; + +export type MagicLinkAction = "createEvent"; + +export interface MagicLink { +    id: string; +    email: string; +    token: string; +    expiryTime: Date; +    permittedActions: MagicLinkAction[]; +} + +const MagicLinkSchema = new mongoose.Schema({ +    email: { +        type: String, +        trim: true, +        required: true, +    }, +    token: { +        type: String, +        trim: true, +        required: true, +    }, +    expiryTime: { +        type: Date, +        trim: true, +        required: true, +    }, +    permittedActions: { +        type: [String], +        required: true, +    }, +}); + +export default mongoose.model<MagicLink>("MagicLink", MagicLinkSchema);  | 
