feat: gist & co-authors

This commit is contained in:
tdurieux
2026-05-04 13:10:44 +02:00
parent f0f6436370
commit f0bc53f093
24 changed files with 1707 additions and 158 deletions
+19
View File
@@ -5,6 +5,8 @@ import AnonymizedRepositoryModel from "../core/model/anonymizedRepositories/anon
import AnonymousError from "../core/AnonymousError";
import AnonymizedPullRequestModel from "../core/model/anonymizedPullRequests/anonymizedPullRequests.model";
import PullRequest from "../core/PullRequest";
import AnonymizedGistModel from "../core/model/anonymizedGists/anonymizedGists.model";
import Gist from "../core/Gist";
const MONGO_URL = `mongodb://${config.DB_USERNAME}:${config.DB_PASSWORD}@${config.DB_HOSTNAME}:27017/`;
@@ -59,3 +61,20 @@ export async function getPullRequest(pullRequestId: string) {
});
return new PullRequest(data);
}
export async function getGist(gistId: string) {
if (!gistId || gistId == "undefined") {
throw new AnonymousError("gist_not_found", {
object: gistId,
httpStatus: 404,
});
}
const data = await AnonymizedGistModel.findOne({
gistId,
});
if (!data)
throw new AnonymousError("gist_not_found", {
object: gistId,
httpStatus: 404,
});
return new Gist(data);
}