-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service): introduce image fetching service
Refactors the SupabaseCachingService to get all hypercert columns except for the image. Renamed the getMetadata method to getMetadataWithoutImage to make this explicit. Introduces MetadataImageService for fetching the image when the field is selected in a metadata query.
- Loading branch information
1 parent
028f072
commit 12038fc
Showing
10 changed files
with
102 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { singleton } from "tsyringe"; | ||
import { kyselyCaching } from "../client/kysely.js"; | ||
import { CachingDatabase } from "../types/kyselySupabaseCaching.js"; | ||
import { BaseSupabaseService } from "./BaseSupabaseService.js"; | ||
|
||
@singleton() | ||
export class MetadataImageService extends BaseSupabaseService<CachingDatabase> { | ||
constructor() { | ||
super(kyselyCaching); | ||
} | ||
|
||
// TODO: remove these when we more refactor the services to improve typing and performance | ||
getDataQuery() { | ||
throw new Error("Method not implemented - not needed for image service"); | ||
} | ||
|
||
getCountQuery() { | ||
throw new Error("Method not implemented - not needed for image service"); | ||
} | ||
|
||
async getImageByUri(uri: string): Promise<string | null> { | ||
const result = await this.db | ||
.selectFrom("metadata") | ||
.select(["image"]) | ||
.where("uri", "=", uri) | ||
.executeTakeFirst(); | ||
|
||
return result?.image ?? null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters