fix(server): wrong import path (#6317)

This commit is contained in:
forehalo
2024-03-26 09:26:56 +00:00
parent 16063340d0
commit 5637676222

View File

@@ -1,13 +1,13 @@
import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { import {
BlobInputType, type BlobInputType,
Cache, Cache,
EventEmitter, EventEmitter,
type EventPayload, type EventPayload,
ListObjectsMetadata, type ListObjectsMetadata,
OnEvent, OnEvent,
StorageProvider, type StorageProvider,
StorageProviderFactory, StorageProviderFactory,
} from '../../../fundamentals'; } from '../../../fundamentals';
@@ -18,14 +18,14 @@ export class WorkspaceBlobStorage {
constructor( constructor(
private readonly event: EventEmitter, private readonly event: EventEmitter,
private readonly storageFactory: StorageProviderFactory, private readonly storageFactory: StorageProviderFactory,
@Inject(forwardRef(() => Cache)) private readonly cache: Cache private readonly cache: Cache
) { ) {
this.provider = this.storageFactory.create('blob'); this.provider = this.storageFactory.create('blob');
} }
async put(workspaceId: string, key: string, blob: BlobInputType) { async put(workspaceId: string, key: string, blob: BlobInputType) {
await this.provider.put(`${workspaceId}/${key}`, blob); await this.provider.put(`${workspaceId}/${key}`, blob);
await this.cache.delete(`blobs:${workspaceId}`); await this.cache.delete(`blob-list:${workspaceId}`);
} }
async get(workspaceId: string, key: string) { async get(workspaceId: string, key: string) {
@@ -34,7 +34,7 @@ export class WorkspaceBlobStorage {
async list(workspaceId: string) { async list(workspaceId: string) {
const cachedList = await this.cache.list<ListObjectsMetadata>( const cachedList = await this.cache.list<ListObjectsMetadata>(
`blobs:${workspaceId}`, `blob-list:${workspaceId}`,
0, 0,
-1 -1
); );
@@ -50,7 +50,7 @@ export class WorkspaceBlobStorage {
item.key = item.key.slice(workspaceId.length + 1); item.key = item.key.slice(workspaceId.length + 1);
}); });
await this.cache.pushBack(`blobs:${workspaceId}`, ...blobs); await this.cache.pushBack(`blob-list:${workspaceId}`, ...blobs);
return blobs; return blobs;
} }