shared-dto 1.0.106 → 1.0.108

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,24 @@
1
+ import { BaseUserDto } from "./UserDTO.dto";
2
+ import { ExpensesResponseDTO } from "./Expenses.dto";
3
+ import { DutyDTO } from "./Duty.dto";
4
+ import { PaymentRequestDTO } from "./PaymentRequest.dto";
5
+ import { ApartmentDTO } from "./Apartment.dto";
6
+ import { TaskDTO } from "./Task.dto";
7
+ export declare class GeneralRequestDTO {
8
+ userUid: string;
9
+ apartmentId: string;
10
+ }
11
+ export declare class GeneralResponseDTO {
12
+ user: BaseUserDto;
13
+ isWaitingForApproval: boolean;
14
+ isHasUserIdOfBit: boolean;
15
+ isAdmin: boolean;
16
+ apartment?: ApartmentDTO;
17
+ apartmentUsers: BaseUserDto[];
18
+ tasks: TaskDTO[];
19
+ shoppingList: TaskDTO[];
20
+ expenses: ExpensesResponseDTO;
21
+ nextDuty: DutyDTO | null;
22
+ paymentRequests: PaymentRequestDTO[];
23
+ }
24
+ //# sourceMappingURL=GeneralRequest.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralRequest.dto.d.ts","sourceRoot":"","sources":["../src/GeneralRequest.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,qBAAa,iBAAiB;IAG5B,OAAO,EAAE,MAAM,CAAC;IAIhB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,kBAAkB;IAK7B,IAAI,EAAE,WAAW,CAAC;IAKlB,oBAAoB,EAAE,OAAO,CAAC;IAI9B,gBAAgB,EAAE,OAAO,CAAC;IAI1B,OAAO,EAAE,OAAO,CAAC;IAMjB,SAAS,CAAC,EAAE,YAAY,CAAC;IAMzB,cAAc,EAAE,WAAW,EAAE,CAAC;IAM9B,KAAK,EAAE,OAAO,EAAE,CAAC;IAKjB,YAAY,EAAE,OAAO,EAAE,CAAC;IAKxB,QAAQ,EAAE,mBAAmB,CAAC;IAM9B,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAMzB,eAAe,EAAE,iBAAiB,EAAE,CAAC;CACtC"}
@@ -0,0 +1,99 @@
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.GeneralResponseDTO = exports.GeneralRequestDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ const UserDTO_dto_1 = require("./UserDTO.dto");
16
+ const Expenses_dto_1 = require("./Expenses.dto");
17
+ const Duty_dto_1 = require("./Duty.dto");
18
+ const PaymentRequest_dto_1 = require("./PaymentRequest.dto");
19
+ const Apartment_dto_1 = require("./Apartment.dto");
20
+ const Task_dto_1 = require("./Task.dto");
21
+ class GeneralRequestDTO {
22
+ }
23
+ exports.GeneralRequestDTO = GeneralRequestDTO;
24
+ __decorate([
25
+ (0, class_validator_1.IsString)(),
26
+ (0, class_validator_1.IsNotEmpty)(),
27
+ __metadata("design:type", String)
28
+ ], GeneralRequestDTO.prototype, "userUid", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsOptional)(),
32
+ __metadata("design:type", String)
33
+ ], GeneralRequestDTO.prototype, "apartmentId", void 0);
34
+ class GeneralResponseDTO {
35
+ }
36
+ exports.GeneralResponseDTO = GeneralResponseDTO;
37
+ __decorate([
38
+ (0, class_validator_1.ValidateNested)(),
39
+ (0, class_transformer_1.Type)(() => UserDTO_dto_1.BaseUserDto),
40
+ (0, class_validator_1.IsNotEmpty)(),
41
+ __metadata("design:type", UserDTO_dto_1.BaseUserDto)
42
+ ], GeneralResponseDTO.prototype, "user", void 0);
43
+ __decorate([
44
+ (0, class_validator_1.IsBoolean)(),
45
+ (0, class_validator_1.IsNotEmpty)(),
46
+ __metadata("design:type", Boolean)
47
+ ], GeneralResponseDTO.prototype, "isWaitingForApproval", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.IsBoolean)(),
50
+ (0, class_validator_1.IsNotEmpty)(),
51
+ __metadata("design:type", Boolean)
52
+ ], GeneralResponseDTO.prototype, "isHasUserIdOfBit", void 0);
53
+ __decorate([
54
+ (0, class_validator_1.IsBoolean)(),
55
+ (0, class_validator_1.IsNotEmpty)(),
56
+ __metadata("design:type", Boolean)
57
+ ], GeneralResponseDTO.prototype, "isAdmin", void 0);
58
+ __decorate([
59
+ (0, class_validator_1.ValidateNested)(),
60
+ (0, class_transformer_1.Type)(() => Apartment_dto_1.ApartmentDTO),
61
+ (0, class_validator_1.IsOptional)(),
62
+ __metadata("design:type", Apartment_dto_1.ApartmentDTO)
63
+ ], GeneralResponseDTO.prototype, "apartment", void 0);
64
+ __decorate([
65
+ (0, class_validator_1.IsArray)(),
66
+ (0, class_validator_1.ValidateNested)({ each: true }),
67
+ (0, class_transformer_1.Type)(() => UserDTO_dto_1.BaseUserDto),
68
+ __metadata("design:type", Array)
69
+ ], GeneralResponseDTO.prototype, "apartmentUsers", void 0);
70
+ __decorate([
71
+ (0, class_validator_1.IsArray)(),
72
+ (0, class_validator_1.ValidateNested)({ each: true }),
73
+ (0, class_transformer_1.Type)(() => Task_dto_1.TaskDTO),
74
+ __metadata("design:type", Array)
75
+ ], GeneralResponseDTO.prototype, "tasks", void 0);
76
+ __decorate([
77
+ (0, class_validator_1.IsArray)(),
78
+ (0, class_validator_1.ValidateNested)({ each: true }),
79
+ (0, class_transformer_1.Type)(() => Task_dto_1.TaskDTO),
80
+ __metadata("design:type", Array)
81
+ ], GeneralResponseDTO.prototype, "shoppingList", void 0);
82
+ __decorate([
83
+ (0, class_validator_1.ValidateNested)(),
84
+ (0, class_transformer_1.Type)(() => Expenses_dto_1.ExpensesResponseDTO),
85
+ __metadata("design:type", Expenses_dto_1.ExpensesResponseDTO)
86
+ ], GeneralResponseDTO.prototype, "expenses", void 0);
87
+ __decorate([
88
+ (0, class_validator_1.ValidateNested)(),
89
+ (0, class_transformer_1.Type)(() => Duty_dto_1.DutyDTO),
90
+ (0, class_validator_1.IsOptional)(),
91
+ __metadata("design:type", Object)
92
+ ], GeneralResponseDTO.prototype, "nextDuty", void 0);
93
+ __decorate([
94
+ (0, class_validator_1.IsArray)(),
95
+ (0, class_validator_1.ValidateNested)({ each: true }),
96
+ (0, class_transformer_1.Type)(() => PaymentRequest_dto_1.PaymentRequestDTO),
97
+ __metadata("design:type", Array)
98
+ ], GeneralResponseDTO.prototype, "paymentRequests", void 0);
99
+ //# sourceMappingURL=GeneralRequest.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralRequest.dto.js","sourceRoot":"","sources":["../src/GeneralRequest.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuG;AACvG,yDAAyC;AACzC,+CAA4C;AAC5C,iDAAqD;AACrD,yCAAqC;AACrC,6DAAyD;AACz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,GAAG,EAAE,CAAC,kCAAmB,CAAC;8BACtB,kCAAmB;oDAAC;AAM9B;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,kBAAO,CAAC;IACnB,IAAA,4BAAU,GAAE;;oDACY;AAMzB;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,sCAAiB,CAAC;;2DACO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-dto",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,79 @@
1
+ import { IsNotEmpty, IsOptional, IsString, IsBoolean, IsArray, ValidateNested } from "class-validator";
2
+ import { Type } from "class-transformer";
3
+ import { BaseUserDto } from "./UserDTO.dto";
4
+ import { ExpensesResponseDTO } from "./Expenses.dto";
5
+ import { DutyDTO } from "./Duty.dto";
6
+ import { PaymentRequestDTO } from "./PaymentRequest.dto";
7
+ import { ApartmentDTO } from "./Apartment.dto";
8
+ import { TaskDTO } from "./Task.dto";
9
+
10
+ export class GeneralRequestDTO {
11
+ @IsString()
12
+ @IsNotEmpty()
13
+ userUid: string;
14
+
15
+ @IsString()
16
+ @IsOptional()
17
+ apartmentId: string;
18
+ }
19
+
20
+ export class GeneralResponseDTO {
21
+ // User data
22
+ @ValidateNested()
23
+ @Type(() => BaseUserDto)
24
+ @IsNotEmpty()
25
+ user: BaseUserDto;
26
+
27
+ // User status flags
28
+ @IsBoolean()
29
+ @IsNotEmpty()
30
+ isWaitingForApproval: boolean;
31
+
32
+ @IsBoolean()
33
+ @IsNotEmpty()
34
+ isHasUserIdOfBit: boolean;
35
+
36
+ @IsBoolean()
37
+ @IsNotEmpty()
38
+ isAdmin: boolean;
39
+
40
+ // Apartment data (optional - only if user has apartment)
41
+ @ValidateNested()
42
+ @Type(() => ApartmentDTO)
43
+ @IsOptional()
44
+ apartment?: ApartmentDTO;
45
+
46
+ // Users array - always returns array (empty if no apartment)
47
+ @IsArray()
48
+ @ValidateNested({ each: true })
49
+ @Type(() => BaseUserDto)
50
+ apartmentUsers: BaseUserDto[];
51
+
52
+ // Tasks arrays - always returns arrays (empty if no tasks)
53
+ @IsArray()
54
+ @ValidateNested({ each: true })
55
+ @Type(() => TaskDTO)
56
+ tasks: TaskDTO[];
57
+
58
+ @IsArray()
59
+ @ValidateNested({ each: true })
60
+ @Type(() => TaskDTO)
61
+ shoppingList: TaskDTO[];
62
+
63
+ // Expenses - always returns object (empty expenses array if no apartment)
64
+ @ValidateNested()
65
+ @Type(() => ExpensesResponseDTO)
66
+ expenses: ExpensesResponseDTO;
67
+
68
+ // Next duty - can be null if no duty
69
+ @ValidateNested()
70
+ @Type(() => DutyDTO)
71
+ @IsOptional()
72
+ nextDuty: DutyDTO | null;
73
+
74
+ // Payment requests - always returns array (empty if no requests)
75
+ @IsArray()
76
+ @ValidateNested({ each: true })
77
+ @Type(() => PaymentRequestDTO)
78
+ paymentRequests: PaymentRequestDTO[];
79
+ }