refactor(trips, feeds): drop added return annotations; no double await on the feed guard

This commit is contained in:
jubnl
2026-09-22 06:41:46 +02:00
parent 39a6d991ce
commit f202227bbc
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -76,7 +76,7 @@ export class FeedsMcp {
})
async getTripCalendarFeed({ tripId }: { tripId: number }, ctx: McpContext) {
const denied = await this.denyTripFeed(tripId, ctx.userId);
if ((await denied)) return denied;
if (denied) return denied;
return ok(await this.feeds.getTripToken(String(tripId), ctx.userId, this.base()));
}
@@ -92,7 +92,7 @@ export class FeedsMcp {
async enableTripCalendarFeed({ tripId }: { tripId: number }, ctx: McpContext) {
if (await this.isDemoUser(ctx.userId)) return demoDenied();
const denied = await this.denyTripFeed(tripId, ctx.userId);
if ((await denied)) return denied;
if (denied) return denied;
return ok(await this.feeds.generateTripToken(String(tripId), ctx.userId, this.base()));
}
@@ -108,7 +108,7 @@ export class FeedsMcp {
async rotateTripCalendarFeed({ tripId }: { tripId: number }, ctx: McpContext) {
if (await this.isDemoUser(ctx.userId)) return demoDenied();
const denied = await this.denyTripFeed(tripId, ctx.userId);
if ((await denied)) return denied;
if (denied) return denied;
return ok(await this.feeds.rotateTripToken(String(tripId), ctx.userId, this.base()));
}
@@ -124,7 +124,7 @@ export class FeedsMcp {
async disableTripCalendarFeed({ tripId }: { tripId: number }, ctx: McpContext) {
if (await this.isDemoUser(ctx.userId)) return demoDenied();
const denied = await this.denyTripFeed(tripId, ctx.userId);
if ((await denied)) return denied;
if (denied) return denied;
await this.feeds.disableTripToken(String(tripId), ctx.userId);
// Matches the route, which answers the cleared token as a null URL.
return ok({ feed_url: null });
+2 -2
View File
@@ -167,7 +167,7 @@ export class TripsService {
return this.dbs.connection;
}
async canAccessTrip(tripId: string | number, userId: number): Promise<{ user_id: number } | null | undefined> {
async canAccessTrip(tripId: string | number, userId: number) {
return this.dbs.canAccessTrip(tripId, userId) as { user_id: number } | null | undefined;
}
@@ -185,7 +185,7 @@ export class TripsService {
// ── Day generation ────────────────────────────────────────────────────────
async generateDays(tripId: number | bigint | string, startDate: string | null, endDate: string | null, dayCount?: number): Promise<void> {
async generateDays(tripId: number | bigint | string, startDate: string | null, endDate: string | null, dayCount?: number) {
const existing = this.db.prepare('SELECT id, day_number, date FROM days WHERE trip_id = ?').all(tripId) as { id: number; day_number: number; date: string | null }[];
const setDayNumber = this.db.prepare('UPDATE days SET day_number = ? WHERE id = ?');