mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-20 22:51:18 +02:00
* fix: prevent duplicate access alerts to the same recipient * fix: address recipient alert recovery review findings * fix: reconcile unsent alerts and wait for startup migration * fix: preserve legacy recipient alerts through upgrades * fix: reconcile alert results and legacy recovery races * fix: fence dispatch and clean cancelled alert metadata * fix: fence alert preparation and retain in-flight recovery * fix: atomically commit alert dispatch and retry deferred recovery * fix: keep recovery lookups from blocking upstream file reads
78 lines
1.8 KiB
TypeScript
78 lines
1.8 KiB
TypeScript
import { Schema } from "mongoose";
|
|
|
|
const AnonymizedGistSchema = new Schema({
|
|
accessAlertGeneration: { type: String, select: false },
|
|
accessAlertClaimedAt: { type: Date, select: false },
|
|
accessAlertAttemptId: { type: String, select: false },
|
|
accessAlertClaimRevision: { type: Number, select: false },
|
|
gistId: {
|
|
type: String,
|
|
index: { unique: true },
|
|
},
|
|
status: {
|
|
type: String,
|
|
default: "preparing",
|
|
},
|
|
statusDate: Date,
|
|
statusMessage: String,
|
|
anonymizeDate: Date,
|
|
lastView: Date,
|
|
pageView: Number,
|
|
owner: { type: Schema.Types.ObjectId, index: true },
|
|
conference: String,
|
|
source: {
|
|
gistId: String,
|
|
accessToken: { type: String, select: false },
|
|
},
|
|
options: {
|
|
terms: [String],
|
|
expirationMode: { type: String },
|
|
expirationDate: Date,
|
|
update: Boolean,
|
|
image: Boolean,
|
|
link: Boolean,
|
|
title: Boolean,
|
|
body: Boolean,
|
|
comments: Boolean,
|
|
content: Boolean,
|
|
origin: Boolean,
|
|
username: Boolean,
|
|
date: Boolean,
|
|
},
|
|
dateOfEntry: {
|
|
type: Date,
|
|
default: Date.now,
|
|
},
|
|
gist: {
|
|
description: String,
|
|
isPublic: Boolean,
|
|
creationDate: Date,
|
|
updatedDate: Date,
|
|
ownerLogin: String,
|
|
files: [
|
|
{
|
|
filename: String,
|
|
content: String,
|
|
language: String,
|
|
size: Number,
|
|
// `type` is a reserved key in Mongoose type declarations; without the
|
|
// nested `{ type: String }` the whole object is compiled as an array
|
|
// of strings and file objects are silently dropped on save.
|
|
type: { type: String },
|
|
},
|
|
],
|
|
comments: [
|
|
{
|
|
body: String,
|
|
creationDate: Date,
|
|
updatedDate: Date,
|
|
author: String,
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
AnonymizedGistSchema.index({ status: 1, "options.expirationDate": 1 });
|
|
|
|
export default AnonymizedGistSchema;
|