@punks/backend-entity-manager 0.0.228 → 0.0.231

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.
@@ -46,6 +46,7 @@ export type IMediaFolderRepository = {
46
46
  folderCreate(input: {
47
47
  name: string;
48
48
  parentId?: string;
49
+ organizationId: string;
49
50
  }): Promise<MediaFolderRecord>;
50
51
  folderRename(id: string, name: string): Promise<void>;
51
52
  folderMove(id: string, parentId?: string): Promise<void>;
@@ -56,6 +57,7 @@ export type IMediaFolderRepository = {
56
57
  export type MediaFolderCreateInput = {
57
58
  folderName: string;
58
59
  parentId?: string;
60
+ organizationId: string;
59
61
  };
60
62
  export type MediaFolderReference = {
61
63
  id: string;
@@ -75,6 +77,7 @@ export type MediaInfo = {
75
77
  };
76
78
  export type MediaFolderEnsureInput = {
77
79
  path: string[];
80
+ organizationId: string;
78
81
  };
79
82
  export type IMediaLibraryManager = {
80
83
  mediaUpload(input: MediaUploadInput): Promise<MediaReference>;
@@ -5,6 +5,7 @@ export type NumericFilter = {
5
5
  gte?: number;
6
6
  lt?: number;
7
7
  lte?: number;
8
+ isNull?: boolean;
8
9
  };
9
10
  export type StringFilter = {
10
11
  gt?: string;
@@ -19,22 +20,26 @@ export type StringFilter = {
19
20
  ine?: string;
20
21
  notIn?: string[];
21
22
  notLike?: string;
23
+ isNull?: boolean;
22
24
  };
23
25
  export type IdFilter = {
24
26
  in?: string[];
25
27
  eq?: string;
26
28
  ne?: string;
27
29
  notIn?: string[];
30
+ isNull?: boolean;
28
31
  };
29
32
  export type EnumFilter<T> = {
30
33
  in?: T[];
31
34
  eq?: T;
32
35
  ne?: T;
33
36
  notIn?: T[];
37
+ isNull?: boolean;
34
38
  };
35
39
  export type BooleanFilter = {
36
40
  eq?: boolean;
37
41
  ne?: boolean;
42
+ isNull?: boolean;
38
43
  };
39
44
  export type DateFilter = {
40
45
  in?: Date[];
@@ -43,4 +48,5 @@ export type DateFilter = {
43
48
  gte?: Date;
44
49
  lt?: Date;
45
50
  lte?: Date;
51
+ isNull?: boolean;
46
52
  };
@@ -21,4 +21,5 @@ export declare class AuthUserRolesService implements IAuthUserRolesService<AppUs
21
21
  removeUserFromRole(userId: string, roleId: string): Promise<void>;
22
22
  removeUserFromRoleByUid(userId: string, roleUid: string): Promise<void>;
23
23
  clearUserRoles(userId: string): Promise<void>;
24
+ isUserInRole(userId: string, roleId: string): Promise<boolean>;
24
25
  }
@@ -5,6 +5,7 @@ export declare class NumericFilter {
5
5
  gte?: number;
6
6
  lt?: number;
7
7
  lte?: number;
8
+ isNull?: boolean;
8
9
  }
9
10
  export declare class StringFilter {
10
11
  gt?: string;
@@ -19,10 +20,25 @@ export declare class StringFilter {
19
20
  ine?: string;
20
21
  notIn?: string[];
21
22
  notLike?: string;
23
+ isNull?: boolean;
24
+ }
25
+ export declare class IdFilter {
26
+ in?: string[];
27
+ eq?: string;
28
+ ne?: string;
29
+ notIn?: string[];
30
+ isNull?: boolean;
31
+ }
32
+ export declare class EnumFilter<T> {
33
+ in?: T[];
34
+ eq?: T;
35
+ ne?: T;
36
+ notIn?: T[];
22
37
  }
23
38
  export declare class BooleanFilter {
24
39
  eq?: boolean;
25
40
  ne?: boolean;
41
+ isNull?: boolean;
26
42
  }
27
43
  export declare class DateFilter {
28
44
  in?: Date[];
@@ -31,4 +47,5 @@ export declare class DateFilter {
31
47
  gte?: Date;
32
48
  lt?: Date;
33
49
  lte?: Date;
50
+ isNull?: boolean;
34
51
  }
@@ -88,4 +88,5 @@ export interface IAuthUserRolesService<TUser extends IAuthUser, TRole extends IA
88
88
  removeUserFromRole(userId: string, roleId: string): Promise<void>;
89
89
  removeUserFromRoleByUid(userId: string, roleUid: string): Promise<void>;
90
90
  clearUserRoles(userId: string): Promise<void>;
91
+ isUserInRole(userId: string, roleId: string): Promise<boolean>;
91
92
  }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Log, csvParse, excelParse, excelBuild, csvBuild, isNullOrUndefined, addTime, newUuid as newUuid$1, buildObject, sort, byField, toDict, ensureTailingSlash, ensureStartSlash, removeUndefinedProps } from '@punks/backend-core';
2
- import { MoreThanOrEqual, In, Equal, Not, And, MoreThan, LessThanOrEqual, LessThan, ILike, Like } from 'typeorm';
2
+ import { MoreThanOrEqual, In, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, Like } from 'typeorm';
3
3
  import { applyDecorators, Injectable, SetMetadata, createParamDecorator, Global, Module, Scope, Logger, StreamableFile, HttpException, HttpStatus } from '@nestjs/common';
4
4
  import { Reflector } from '@nestjs/core';
5
5
  import { AsyncLocalStorage } from 'async_hooks';
@@ -2864,6 +2864,12 @@ class QueryClauseBuilder {
2864
2864
  if (!!filter?.notIn) {
2865
2865
  clauses.push(Not(In(filter.notIn)));
2866
2866
  }
2867
+ if (filter?.isNull === true) {
2868
+ clauses.push(IsNull());
2869
+ }
2870
+ if (filter?.isNull === false) {
2871
+ clauses.push(Not(IsNull()));
2872
+ }
2867
2873
  return And(...clauses);
2868
2874
  }
2869
2875
  idFilter(filter) {
@@ -2880,6 +2886,12 @@ class QueryClauseBuilder {
2880
2886
  if (!!filter?.notIn) {
2881
2887
  clauses.push(Not(In(filter.notIn)));
2882
2888
  }
2889
+ if (filter?.isNull === true) {
2890
+ clauses.push(IsNull());
2891
+ }
2892
+ if (filter?.isNull === false) {
2893
+ clauses.push(Not(IsNull()));
2894
+ }
2883
2895
  return And(...clauses);
2884
2896
  }
2885
2897
  stringFilter(filter) {
@@ -2920,6 +2932,12 @@ class QueryClauseBuilder {
2920
2932
  if (!!filter?.notLike) {
2921
2933
  clauses.push(Not(Like(filter.notLike.replaceAll("*", "%"))));
2922
2934
  }
2935
+ if (filter?.isNull === true) {
2936
+ clauses.push(IsNull());
2937
+ }
2938
+ if (filter?.isNull === false) {
2939
+ clauses.push(Not(IsNull()));
2940
+ }
2923
2941
  return And(...clauses);
2924
2942
  }
2925
2943
  numericFilter(filter) {
@@ -2936,6 +2954,12 @@ class QueryClauseBuilder {
2936
2954
  if (!!filter?.lt) {
2937
2955
  clauses.push(LessThan(filter.lt));
2938
2956
  }
2957
+ if (filter?.isNull === true) {
2958
+ clauses.push(IsNull());
2959
+ }
2960
+ if (filter?.isNull === false) {
2961
+ clauses.push(Not(IsNull()));
2962
+ }
2939
2963
  return And(...clauses);
2940
2964
  }
2941
2965
  dateFilter(filter) {
@@ -2952,6 +2976,12 @@ class QueryClauseBuilder {
2952
2976
  if (!!filter?.lt) {
2953
2977
  clauses.push(LessThan(filter.lt));
2954
2978
  }
2979
+ if (filter?.isNull === true) {
2980
+ clauses.push(IsNull());
2981
+ }
2982
+ if (filter?.isNull === false) {
2983
+ clauses.push(Not(IsNull()));
2984
+ }
2955
2985
  return And(...clauses);
2956
2986
  }
2957
2987
  boolFilter(filter) {
@@ -2962,6 +2992,12 @@ class QueryClauseBuilder {
2962
2992
  if (!isNullOrUndefined(filter?.ne)) {
2963
2993
  clauses.push(Not(Equal(filter.ne)));
2964
2994
  }
2995
+ if (filter?.isNull === true) {
2996
+ clauses.push(IsNull());
2997
+ }
2998
+ if (filter?.isNull === false) {
2999
+ clauses.push(Not(IsNull()));
3000
+ }
2965
3001
  return And(...clauses);
2966
3002
  }
2967
3003
  }
@@ -21386,6 +21422,7 @@ let MediaLibraryService = class MediaLibraryService {
21386
21422
  folder = await this.mediaFolderRepository.folderCreate({
21387
21423
  name: folderName,
21388
21424
  parentId: parentFolder?.id,
21425
+ organizationId: input.organizationId,
21389
21426
  });
21390
21427
  }
21391
21428
  parentFolder = folder;
@@ -21399,6 +21436,7 @@ let MediaLibraryService = class MediaLibraryService {
21399
21436
  return await this.mediaFolderRepository.folderCreate({
21400
21437
  name: input.folderName,
21401
21438
  parentId: input.parentId,
21439
+ organizationId: input.organizationId,
21402
21440
  });
21403
21441
  }
21404
21442
  async folderMove(input) {