mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
refactor(trips, feeds): drop added return annotations; no double await on the feed guard
This commit is contained in:
@@ -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 });
|
||||
|
||||
@@ -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 = ?');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user