clhq-postgres-module 1.1.0-alpha.94 → 1.1.0-alpha.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ export declare class Asset {
21
21
  uploadedBy: string;
22
22
  user: User;
23
23
  categoryId: string;
24
+ uniqueId: string;
24
25
  name: string;
25
26
  originalFilename: string;
26
27
  fileType: string;
@@ -58,6 +58,10 @@ __decorate([
58
58
  (0, typeorm_1.Column)({ name: 'category_id', type: 'uuid', nullable: true }),
59
59
  __metadata("design:type", String)
60
60
  ], Asset.prototype, "categoryId", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ name: 'unique_id', type: 'varchar', length: 255, nullable: true }),
63
+ __metadata("design:type", String)
64
+ ], Asset.prototype, "uniqueId", void 0);
61
65
  __decorate([
62
66
  (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
63
67
  __metadata("design:type", String)
@@ -7,6 +7,7 @@ export declare class AssetRepository extends BaseRepository<Asset> {
7
7
  findByWorkspace(workspaceId: string): Promise<Asset[]>;
8
8
  findByFileType(workspaceId: string, fileType: string): Promise<Asset[]>;
9
9
  findByUser(userId: string): Promise<Asset[]>;
10
+ findByUniqueId(uniqueId: string): Promise<Asset | null>;
10
11
  searchByName(workspaceId: string, searchTerm: string): Promise<Asset[]>;
11
12
  findByUploadedBy(userId: string): Promise<Asset[]>;
12
13
  findByWorkspaceId(workspaceId: string): Promise<Asset[]>;
@@ -14,6 +15,7 @@ export declare class AssetRepository extends BaseRepository<Asset> {
14
15
  updateUploadStatus(id: string, uploadStatus: string): Promise<Asset | null>;
15
16
  bulkUpdateUploadStatus(ids: string[], uploadStatus: string): Promise<void>;
16
17
  updateMetadata(id: string, metadata: Record<string, any>): Promise<Asset | null>;
18
+ updateProcessingMetadata(uniqueId: string, processingData: Record<string, any>): Promise<Asset | null>;
17
19
  getAll(): Promise<Asset[]>;
18
20
  findByUserOrLegacy(userId: string): Promise<Asset[]>;
19
21
  incrementUsageCount(id: string): Promise<void>;
@@ -44,6 +44,11 @@ let AssetRepository = class AssetRepository extends base_repository_1.BaseReposi
44
44
  order: { createdAt: 'DESC' }
45
45
  });
46
46
  }
47
+ async findByUniqueId(uniqueId) {
48
+ return this.assetRepository.findOne({
49
+ where: { uniqueId },
50
+ });
51
+ }
47
52
  async searchByName(workspaceId, searchTerm) {
48
53
  return this.assetRepository
49
54
  .createQueryBuilder('asset')
@@ -75,6 +80,21 @@ let AssetRepository = class AssetRepository extends base_repository_1.BaseReposi
75
80
  await this.assetRepository.update(id, { metadata });
76
81
  return this.findById(id);
77
82
  }
83
+ async updateProcessingMetadata(uniqueId, processingData) {
84
+ const asset = await this.findByUniqueId(uniqueId);
85
+ if (!asset)
86
+ return null;
87
+ const existingMetadata = asset.metadata || {};
88
+ const updatedMetadata = {
89
+ ...existingMetadata,
90
+ processing: {
91
+ ...existingMetadata.processing,
92
+ ...processingData,
93
+ },
94
+ };
95
+ await this.assetRepository.update(asset.id, { metadata: updatedMetadata });
96
+ return this.findById(asset.id);
97
+ }
78
98
  async getAll() {
79
99
  return this.assetRepository.find({
80
100
  order: { createdAt: 'DESC' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clhq-postgres-module",
3
- "version": "1.1.0-alpha.94",
3
+ "version": "1.1.0-alpha.95",
4
4
  "description": "PostgreSQL module using TypeORM for Clippy",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",