@stemy/backend 5.0.3 → 5.0.6

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.
@@ -30,6 +30,7 @@ import { v4 } from 'uuid';
30
30
  import { createTransport } from 'nodemailer';
31
31
  import * as Handlebars from 'handlebars';
32
32
  import { routingControllersToSpec, OpenAPI, getStatusCode } from 'routing-controllers-openapi';
33
+ import { defaultMetadataStorage } from 'class-transformer/cjs/storage';
33
34
  import { validationMetadatasToSchemas } from 'class-validator-jsonschema';
34
35
  import { ValidatorConstraint, ValidationTypes, Min, Max, IsOptional, IsBoolean } from 'class-validator';
35
36
  import { CommandsAddon, AnsiCodes } from '@stemy/terminal-commands-addon';
@@ -2458,6 +2459,7 @@ let OpenApi = class OpenApi {
2458
2459
  const docs = routingControllersToSpec(storage);
2459
2460
  docs.basePath = "/api/";
2460
2461
  docs.definitions = validationMetadatasToSchemas({
2462
+ classTransformerMetadataStorage: defaultMetadataStorage,
2461
2463
  additionalConverters: {
2462
2464
  [ValidationTypes.CUSTOM_VALIDATION]: (meta, options) => {
2463
2465
  const res = isFunction(this.customValidation) ? this.customValidation(meta, options) : this.customValidation;
@@ -2711,6 +2713,13 @@ let AssetsController = class AssetsController {
2711
2713
  const asset = await this.getAsset("Asset", id, lazy, res);
2712
2714
  return asset.download();
2713
2715
  }
2716
+ async getMetadata(id, lazy, res) {
2717
+ const asset = await this.assetResolver.resolve(id, lazy);
2718
+ if (!asset) {
2719
+ throw new HttpError(404, `Asset with id: '${id}' not found.`);
2720
+ }
2721
+ return asset.metadata;
2722
+ }
2714
2723
  async getImageRotation(id, params, res, rotation = 0) {
2715
2724
  const asset = await this.getAsset("Image", id, params.lazy, res);
2716
2725
  if (rotation !== 0) {
@@ -2783,6 +2792,15 @@ __decorate([
2783
2792
  __metadata("design:paramtypes", [String, Boolean, Object]),
2784
2793
  __metadata("design:returntype", Promise)
2785
2794
  ], AssetsController.prototype, "getFile", null);
2795
+ __decorate([
2796
+ Get("/metadata/:id"),
2797
+ __param(0, Param("id")),
2798
+ __param(1, QueryParam("lazy")),
2799
+ __param(2, Res()),
2800
+ __metadata("design:type", Function),
2801
+ __metadata("design:paramtypes", [String, Boolean, Object]),
2802
+ __metadata("design:returntype", Promise)
2803
+ ], AssetsController.prototype, "getMetadata", null);
2786
2804
  __decorate([
2787
2805
  Get("/image/:id/:rotation"),
2788
2806
  __param(0, Param("id")),