@fiado/type-kit 1.0.22 → 1.0.24

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.
@@ -0,0 +1,8 @@
1
+ import { RelationType } from "../enums/RelationType";
2
+ import { RelationStatus } from "../enums/RelationStatus";
3
+ export declare class GroupAddDirectoryRequest {
4
+ groupId: string;
5
+ directoryIds: string[];
6
+ relationType: RelationType;
7
+ status: RelationStatus;
8
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GroupAddDirectoryRequest = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const RelationType_1 = require("../enums/RelationType");
15
+ const RelationStatus_1 = require("../enums/RelationStatus");
16
+ class GroupAddDirectoryRequest {
17
+ constructor() {
18
+ this.relationType = RelationType_1.RelationType.MEMBER; // Default value MEMBER
19
+ this.status = RelationStatus_1.RelationStatus.ACTIVE; // Default value ACTIVE
20
+ }
21
+ }
22
+ exports.GroupAddDirectoryRequest = GroupAddDirectoryRequest;
23
+ __decorate([
24
+ (0, class_validator_1.IsNotEmpty)(),
25
+ (0, class_validator_1.IsString)(),
26
+ (0, class_validator_1.Length)(3, 50),
27
+ __metadata("design:type", String)
28
+ ], GroupAddDirectoryRequest.prototype, "groupId", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.ArrayNotEmpty)(),
31
+ (0, class_validator_1.IsUUID)(4, { each: true }),
32
+ __metadata("design:type", Array)
33
+ ], GroupAddDirectoryRequest.prototype, "directoryIds", void 0);
34
+ __decorate([
35
+ (0, class_validator_1.IsEnum)(RelationType_1.RelationType),
36
+ (0, class_validator_1.IsNotEmpty)(),
37
+ __metadata("design:type", String)
38
+ ], GroupAddDirectoryRequest.prototype, "relationType", void 0);
39
+ __decorate([
40
+ (0, class_validator_1.IsEnum)(RelationStatus_1.RelationStatus),
41
+ (0, class_validator_1.IsNotEmpty)(),
42
+ __metadata("design:type", String)
43
+ ], GroupAddDirectoryRequest.prototype, "status", void 0);
@@ -5,5 +5,5 @@ export declare class GroupCreateRequest {
5
5
  description: string;
6
6
  leader: string;
7
7
  status: GroupStatus;
8
- codeToRefer: string;
8
+ codeToRefer: string | null;
9
9
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.GroupCreateRequest = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const GroupStatus_1 = require("../enums/GroupStatus");
15
+ const class_transformer_1 = require("class-transformer");
15
16
  class GroupCreateRequest {
16
17
  }
17
18
  exports.GroupCreateRequest = GroupCreateRequest;
@@ -45,5 +46,6 @@ __decorate([
45
46
  __decorate([
46
47
  (0, class_validator_1.IsOptional)(),
47
48
  (0, class_validator_1.Length)(3, 20),
49
+ (0, class_transformer_1.Transform)(({ value }) => value ?? null),
48
50
  __metadata("design:type", String)
49
51
  ], GroupCreateRequest.prototype, "codeToRefer", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,22 @@
1
+ import { IsNotEmpty, IsString, IsUUID, Length, ArrayNotEmpty, IsEnum } from "class-validator";
2
+ import { RelationType } from "../enums/RelationType";
3
+ import { RelationStatus } from "../enums/RelationStatus";
4
+
5
+ export class GroupAddDirectoryRequest {
6
+ @IsNotEmpty()
7
+ @IsString()
8
+ @Length(3, 50)
9
+ groupId: string;
10
+
11
+ @ArrayNotEmpty()
12
+ @IsUUID(4, { each: true })
13
+ directoryIds: string[];
14
+
15
+ @IsEnum(RelationType)
16
+ @IsNotEmpty()
17
+ relationType: RelationType = RelationType.MEMBER; // Default value MEMBER
18
+
19
+ @IsEnum(RelationStatus)
20
+ @IsNotEmpty()
21
+ status: RelationStatus = RelationStatus.ACTIVE; // Default value ACTIVE
22
+ }
@@ -1,5 +1,6 @@
1
1
  import { IsEmail, IsEnum, IsNotEmpty, IsOptional, IsString, Length } from "class-validator";
2
2
  import { GroupStatus } from "../enums/GroupStatus";
3
+ import { Transform } from "class-transformer";
3
4
 
4
5
 
5
6
 
@@ -29,5 +30,6 @@ export class GroupCreateRequest {
29
30
 
30
31
  @IsOptional()
31
32
  @Length(3, 20)
32
- codeToRefer: string;
33
+ @Transform(({ value }) => value ?? null)
34
+ codeToRefer: string | null;
33
35
  }