@punks/backend-entity-manager 0.0.361 → 0.0.363

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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  export type FileData = {
3
+ fileId?: string;
3
4
  content: Buffer;
4
5
  contentType: string;
5
6
  fileName: string;
@@ -25,6 +26,7 @@ export type FilesReferenceData = {
25
26
  reference: string;
26
27
  providerId: string;
27
28
  metadata?: Record<string, any>;
29
+ fileId?: string;
28
30
  fileName: string;
29
31
  filePath: string;
30
32
  fileSize: number;
@@ -49,6 +51,7 @@ export type FileProviderReference = {
49
51
  reference: string;
50
52
  };
51
53
  export type FileProviderUploadData = {
54
+ fileId?: string;
52
55
  fileName: string;
53
56
  content: Buffer;
54
57
  contentType: string;
@@ -53,3 +53,9 @@ export type DateFilter = {
53
53
  lte?: Date;
54
54
  isNull?: boolean;
55
55
  };
56
+ export type StringListFilter = {
57
+ contains?: string;
58
+ iContains?: string;
59
+ notContains?: string;
60
+ iNotContains?: string;
61
+ };
@@ -1,9 +1,10 @@
1
1
  import { FindOperator } from "typeorm";
2
- import { BooleanFilter, DateFilter, EnumFilter, IdFilter, NumericFilter, StringFilter } from "./clause";
2
+ import { BooleanFilter, DateFilter, EnumFilter, IdFilter, NumericFilter, StringFilter, StringListFilter } from "./clause";
3
3
  export declare class QueryClauseBuilder {
4
4
  enumFilter<T>(filter: EnumFilter<T>): FindOperator<T>;
5
5
  idFilter(filter: IdFilter): FindOperator<string>;
6
6
  stringFilter(filter: StringFilter): FindOperator<string>;
7
+ stringListFilter(filter: StringListFilter): FindOperator<string>;
7
8
  numericFilter(filter: NumericFilter): FindOperator<number>;
8
9
  dateFilter(filter: DateFilter): FindOperator<Date>;
9
10
  boolFilter(filter: BooleanFilter): FindOperator<boolean>;
@@ -6,6 +6,6 @@ export declare class AppFileController {
6
6
  private readonly getDownloadUrlTemplate;
7
7
  private readonly fileUploadTemplate;
8
8
  constructor(getDownloadUrlTemplate: FileGetDownloadUrlTemplate, fileUploadTemplate: FileUploadTemplate);
9
- import(folderPath: string, file: Express.Multer.File): Promise<void>;
9
+ import(fileId: string | undefined, folderPath: string, file: Express.Multer.File): Promise<void>;
10
10
  getDownloadUrl(fileId: string): Promise<FileGetDownloadUrlResult>;
11
11
  }
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { Log, csvParse, excelParse, excelBuild, csvBuild, mapAsync, isNullOrUnde
2
2
  import { QueryCommand, ScanCommand, GetItemCommand, PutItemCommand, DeleteItemCommand, DynamoDBClient } from '@aws-sdk/client-dynamodb';
3
3
  import { unmarshall, marshall } from '@aws-sdk/util-dynamodb';
4
4
  import { Module, applyDecorators, Injectable, SetMetadata, createParamDecorator, Global, Scope, Inject, Logger, StreamableFile, HttpException, HttpStatus } from '@nestjs/common';
5
- import { MoreThanOrEqual, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, In, Or, Repository } from 'typeorm';
5
+ import { MoreThanOrEqual, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, Like, In, Or, Repository } from 'typeorm';
6
6
  import { Reflector } from '@nestjs/core';
7
7
  import { AsyncLocalStorage } from 'async_hooks';
8
8
  import { hash } from 'bcrypt';
@@ -3566,6 +3566,16 @@ class QueryClauseBuilder {
3566
3566
  }
3567
3567
  return And(...clauses);
3568
3568
  }
3569
+ stringListFilter(filter) {
3570
+ const clauses = [];
3571
+ if (!isNullOrUndefined(filter?.contains)) {
3572
+ clauses.push(Like(`%${filter.contains}%`));
3573
+ }
3574
+ if (!isNullOrUndefined(filter?.iContains)) {
3575
+ clauses.push(ILike(`%${filter.iContains}%`));
3576
+ }
3577
+ return And(...clauses);
3578
+ }
3569
3579
  numericFilter(filter) {
3570
3580
  const clauses = [];
3571
3581
  if (!isNullOrUndefined(filter?.gte)) {
@@ -22634,11 +22644,13 @@ let FilesManager = class FilesManager {
22634
22644
  }
22635
22645
  async uploadFile(file) {
22636
22646
  const uploadResult = await this.defaultFileProvider.uploadFile({
22647
+ fileId: file.fileId,
22637
22648
  content: file.content,
22638
22649
  contentType: file.contentType,
22639
22650
  fileName: file.fileName,
22640
22651
  });
22641
22652
  const record = await this.referencesRepo.createReference({
22653
+ fileId: file.fileId,
22642
22654
  providerId: this.defaultFileProvider.getProviderId(),
22643
22655
  reference: uploadResult.reference,
22644
22656
  contentType: file.contentType,