Files
anonymous_github/src/core/model/anonymizedPullRequests/anonymizedPullRequests.schema.ts
T
Thomas Durieux 6434337923 perf: bound request work and resource usage (#866)
* perf: bound request work and resource usage

* fix: address performance review regressions

* fix: guard content expiration and dashboard state

* fix: tolerate cache outages and retire derived paths

* fix: revalidate expiration claims and status pagination

* fix: retry interrupted repository metadata cleanup

* fix: retire obsolete content cache storage

* fix: activate tree metadata and recheck expiration claims

* fix: fence cache publication across expiration

* fix: recover staged trees and enforce cache lifecycle cleanup

* fix: prune expired transforms during database outages

* fix: finish conference removals and reload expiration candidates
2026-10-08 03:38:19 +01:00

71 lines
1.5 KiB
TypeScript

import { repositoryAccessSchema } from "../repository-access.schema";
import { Schema } from "mongoose";
const AnonymizedPullRequestSchema = new Schema({
pullRequestId: {
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 },
githubAccess: { type: repositoryAccessSchema, default: undefined },
conference: String,
source: {
pullRequestId: Number,
repositoryFullName: 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,
diff: Boolean,
origin: Boolean,
username: Boolean,
date: Boolean,
},
dateOfEntry: {
type: Date,
default: Date.now,
},
pullRequest: {
diff: String,
title: String,
body: String,
creationDate: Date,
updatedDate: Date,
draft: Boolean,
merged: Boolean,
mergedDate: Date,
state: String,
baseRepositoryFullName: String,
headRepositoryFullName: String,
comments: [
{
body: String,
creationDate: Date,
updatedDate: Date,
author: String,
},
],
},
});
AnonymizedPullRequestSchema.index({ status: 1, "options.expirationDate": 1 });
export default AnonymizedPullRequestSchema;