Skip to content

Commit 20b3188

Browse files
committed
feat: add admin option to force resync titles with Intra
1 parent c2a8471 commit 20b3188

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/routes/admin/titles.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,17 @@ export const setupAdminTitleRoutes = function(app: Express, prisma: PrismaClient
198198

199199
return res.redirect(`/admin/titles`);
200200
});
201+
202+
app.get('/admin/titles/force_resync_all', async function(req, res) {
203+
// Delete intra_title_user_ids from local database
204+
// This allows for a resync of the title on Intra if needed during Intra synchronization
205+
await prisma.codamCoalitionTitleUser.updateMany({
206+
where: {},
207+
data: {
208+
intra_title_user_id: null,
209+
}
210+
});
211+
212+
return res.redirect(`/admin/titles`);
213+
});
201214
};

templates/admin/titles.njk

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,19 @@
7575
</form>
7676
</div>
7777
</div>
78+
79+
<div class="card w-100 mt-4 mb-4" id="title-force-resync">
80+
<div class="card-header pe-2 d-flex align-items-center">
81+
<h4 class="d-inline-block pe-3 lh-lg flex-grow-1">Force resync all titles</h4>
82+
<div class="d-inline-block">
83+
84+
</div>
85+
</div>
86+
<div class="card-body">
87+
<form action="/admin/titles/force_resync_all" method="get" class="mb-3">
88+
<p>Clicking the button below will enqueue a job to force resync all titles for all users with Intra. This may take a while depending on the number of users in the system.</p>
89+
<button type="submit" class="btn btn-warning w-100">Force resync all titles</button>
90+
</form>
91+
</div>
92+
</div>
7893
{% endblock %}

0 commit comments

Comments
 (0)