2024-05-28 16:45:34 +00:00
|
|
|
import * as plugins from '../plugins.js';
|
2024-04-20 10:21:41 +00:00
|
|
|
import type { ImageManager } from './classes.imagemanager.js';
|
|
|
|
|
2024-06-01 03:48:57 +00:00
|
|
|
@plugins.smartdata.managed()
|
2024-10-27 18:50:39 +00:00
|
|
|
export class Image extends plugins.smartdata.SmartDataDbDoc<
|
|
|
|
Image,
|
|
|
|
plugins.servezoneInterfaces.data.IImage,
|
|
|
|
ImageManager
|
|
|
|
> {
|
|
|
|
public static async create(
|
|
|
|
imageDataArg: Partial<plugins.servezoneInterfaces.data.IImage['data']>,
|
|
|
|
) {
|
2024-04-20 10:21:41 +00:00
|
|
|
const image = new Image();
|
2024-06-01 03:48:57 +00:00
|
|
|
image.id = await this.getNewId();
|
|
|
|
console.log(imageDataArg);
|
|
|
|
Object.assign(image, {
|
|
|
|
data: {
|
|
|
|
name: imageDataArg.name,
|
|
|
|
description: imageDataArg.description,
|
|
|
|
versions: [],
|
|
|
|
},
|
|
|
|
});
|
2024-10-27 18:50:39 +00:00
|
|
|
console.log((Image as any).saveableProperties);
|
2024-04-20 10:21:41 +00:00
|
|
|
await image.save();
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
@plugins.smartdata.unI()
|
|
|
|
public id: string;
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
public data: plugins.servezoneInterfaces.data.IImage['data'];
|
|
|
|
|
|
|
|
public async getVersions() {}
|
2024-06-02 19:39:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* returns a storage path
|
|
|
|
* note: this is relative to the storage method defined by the imageManager
|
|
|
|
*/
|
|
|
|
public async getStoragePath(versionStringArg: string) {
|
2024-10-27 18:50:39 +00:00
|
|
|
return `${this.data.name}:${versionStringArg}`.replace('/', '__');
|
2024-06-02 19:39:31 +00:00
|
|
|
}
|
2024-10-16 12:35:38 +00:00
|
|
|
|
2024-10-27 18:50:39 +00:00
|
|
|
public async getWriteStream() {}
|
2024-10-16 12:35:38 +00:00
|
|
|
|
2024-10-27 18:50:39 +00:00
|
|
|
public async getReadStream() {}
|
|
|
|
}
|