mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-16 06:49:09 +02:00
fix persistance bugs
This commit is contained in:
@@ -166,6 +166,16 @@ router.post(
|
||||
|
||||
updateGistModel(gist.model, gistUpdate);
|
||||
gist.model.conference = gistUpdate.conference;
|
||||
await AnonymizedGistModel.updateOne(
|
||||
{ _id: gist.model._id },
|
||||
{
|
||||
$set: {
|
||||
options: gist.model.options,
|
||||
conference: gist.model.conference,
|
||||
anonymizeDate: gist.model.anonymizeDate,
|
||||
},
|
||||
}
|
||||
).exec();
|
||||
await gist.updateStatus(RepositoryStatus.PREPARING);
|
||||
await gist.updateIfNeeded({ force: true });
|
||||
res.json(gist.toJSON());
|
||||
@@ -200,6 +210,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
||||
|
||||
gist.model.conference = gistUpdate.conference;
|
||||
|
||||
await gist.model.save();
|
||||
await gist.anonymize();
|
||||
res.send(gist.toJSON());
|
||||
} catch (error) {
|
||||
|
||||
@@ -186,6 +186,16 @@ router.post(
|
||||
updatePullRequestModel(pullRequest.model, pullRequestUpdate);
|
||||
// TODO handle conference
|
||||
pullRequest.model.conference = pullRequestUpdate.conference;
|
||||
await AnonymizedPullRequestModel.updateOne(
|
||||
{ _id: pullRequest.model._id },
|
||||
{
|
||||
$set: {
|
||||
options: pullRequest.model.options,
|
||||
conference: pullRequest.model.conference,
|
||||
anonymizeDate: pullRequest.model.anonymizeDate,
|
||||
},
|
||||
}
|
||||
).exec();
|
||||
await pullRequest.updateStatus(RepositoryStatus.PREPARING);
|
||||
await pullRequest.updateIfNeeded({ force: true });
|
||||
res.json(pullRequest.toJSON());
|
||||
@@ -222,6 +232,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
||||
|
||||
pullRequest.conference = pullRequestUpdate.conference;
|
||||
|
||||
await pullRequest.model.save();
|
||||
await pullRequest.anonymize();
|
||||
res.send(pullRequest.toJSON());
|
||||
} catch (error) {
|
||||
|
||||
@@ -480,6 +480,17 @@ router.post(
|
||||
}
|
||||
}
|
||||
repo.model.conference = repoUpdate.conference;
|
||||
await AnonymizedRepositoryModel.updateOne(
|
||||
{ _id: repo.model._id },
|
||||
{
|
||||
$set: {
|
||||
options: repo.model.options,
|
||||
source: repo.model.source,
|
||||
conference: repo.model.conference,
|
||||
anonymizeDate: repo.model.anonymizeDate,
|
||||
},
|
||||
}
|
||||
).exec();
|
||||
await repo.updateStatus(RepositoryStatus.PREPARING);
|
||||
res.json({ status: repo.status });
|
||||
await downloadQueue.add(repo.repoId, { repoId: repo.repoId }, { jobId: repo.repoId });
|
||||
|
||||
@@ -83,7 +83,7 @@ export async function getRepo(
|
||||
return null;
|
||||
}
|
||||
|
||||
repo.check();
|
||||
await repo.check();
|
||||
}
|
||||
return repo;
|
||||
} catch (error) {
|
||||
|
||||
@@ -35,10 +35,10 @@ export function repositoryStatusCheck() {
|
||||
status: { $eq: "ready" },
|
||||
isReseted: { $eq: false },
|
||||
})
|
||||
).forEach((data) => {
|
||||
).forEach(async (data) => {
|
||||
const repo = new Repository(data);
|
||||
try {
|
||||
repo.check();
|
||||
await repo.check();
|
||||
} catch {
|
||||
logger.info("repository expired", { repoId: repo.repoId });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user