From 65f1b6f35e8317cb08598e4de6fa781907ea4d7d Mon Sep 17 00:00:00 2001 From: pinocchio-life-like Date: Sat, 28 Dec 2024 02:15:19 +0300 Subject: [PATCH] services directory type fix done --- server/src/services/auth/logoutService.ts | 2 +- server/src/services/auth/refreshTokenService.ts | 2 +- server/src/services/favorite/getUserFavoritesService.ts | 2 +- server/src/services/geojsonStorage/index.ts | 8 +++++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/server/src/services/auth/logoutService.ts b/server/src/services/auth/logoutService.ts index fc5a247ff..1bb8acacb 100644 --- a/server/src/services/auth/logoutService.ts +++ b/server/src/services/auth/logoutService.ts @@ -1,4 +1,4 @@ -import { User as UserRepository } from 'src/drizzle/methods/User'; +import { User as UserRepository } from '../../drizzle/methods/User'; export const logoutService = async (refreshToken: string) => { const userRepository = new UserRepository(); diff --git a/server/src/services/auth/refreshTokenService.ts b/server/src/services/auth/refreshTokenService.ts index 5d45e5edb..1c9ac5cc9 100644 --- a/server/src/services/auth/refreshTokenService.ts +++ b/server/src/services/auth/refreshTokenService.ts @@ -1,5 +1,5 @@ import * as jwt from 'hono/jwt'; -import { User as UserRepository } from 'src/drizzle/methods/User'; +import { User as UserRepository } from '../../drizzle/methods/User'; export const refreshTokenService = async ( jwtSecret: string, diff --git a/server/src/services/favorite/getUserFavoritesService.ts b/server/src/services/favorite/getUserFavoritesService.ts index 81fa13e94..a983ea5a8 100644 --- a/server/src/services/favorite/getUserFavoritesService.ts +++ b/server/src/services/favorite/getUserFavoritesService.ts @@ -1,6 +1,6 @@ import { Feed } from '../../modules/feed/model'; import { User } from '../../drizzle/methods/User'; -import { PaginationParams } from 'src/helpers/pagination'; +import { PaginationParams } from '../../helpers/pagination'; /** * Retrieves the favorite packs associated with a specific user. diff --git a/server/src/services/geojsonStorage/index.ts b/server/src/services/geojsonStorage/index.ts index 73d1ad759..c95b35a31 100644 --- a/server/src/services/geojsonStorage/index.ts +++ b/server/src/services/geojsonStorage/index.ts @@ -13,7 +13,7 @@ export class GeojsonStorageService { } public static get instance(): R2Bucket { - if (!GeojsonStorageService._instance) { + if (!GeojsonStorageService._instance || !GeojsonStorageService._bucket) { throw new Error('GeojsonStorageService instance not initialized.'); } return GeojsonStorageService._bucket; @@ -24,6 +24,9 @@ export class GeojsonStorageService { geojson: string, resourceId: string, ): Promise { + if (!this._bucket) { + throw new Error('GeojsonStorageService bucket not initialized.'); + } return this._bucket.put(`${resource}/${resourceId}`, geojson); } @@ -31,6 +34,9 @@ export class GeojsonStorageService { resource: ResourceType, resourceId: string, ): Promise { + if (!this._bucket) { + throw new Error('GeojsonStorageService bucket not initialized.'); + } return this._bucket.get(`${resource}/${resourceId}`); } }