refactor(assignments, public-api, accommodations, places): async DB-touching methods; transactions through UnitOfWork

This commit is contained in:
jubnl
2026-09-22 05:21:48 +02:00
parent 3a8b54d761
commit 5c8decd3ea
37 changed files with 616 additions and 589 deletions
@@ -225,7 +225,7 @@ export class DawarichSuggestionsService {
if (body.dayId !== undefined) {
await this.requirePermission('day_edit', access.user_id, userId);
if (!this.assignments.dayExists(body.dayId, tripId)) {
if (!(await this.assignments.dayExists(body.dayId, tripId))) {
throw new AcceptError('day_not_on_trip', 'Day does not belong to this trip', 400);
}
}
@@ -238,7 +238,7 @@ export class DawarichSuggestionsService {
// worse than none: the stay would come back as unhandled while the place it
// already produced sat on the trip.
const { created, placeId, assignment } = await this.uow.transactional(async () => {
const place = this.places.create(String(tripId), {
const place = await this.places.create(String(tripId), {
name: body.name?.trim() || row.name,
lat,
lng,