@budgetbuddyde/api 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +366 -0
- package/lib/api.d.ts +17 -0
- package/lib/api.js +22 -0
- package/lib/budget.d.ts +3 -0
- package/lib/budget.js +19 -0
- package/lib/category.d.ts +3 -0
- package/lib/category.js +19 -0
- package/lib/error.d.ts +33 -0
- package/lib/error.js +55 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +22 -0
- package/lib/paymentMethod.d.ts +3 -0
- package/lib/paymentMethod.js +19 -0
- package/lib/recurringPayment.d.ts +4 -0
- package/lib/recurringPayment.js +20 -0
- package/lib/services/budget.service.d.ts +8 -0
- package/lib/services/budget.service.js +43 -0
- package/lib/services/category.service.d.ts +24 -0
- package/lib/services/category.service.js +98 -0
- package/lib/services/entity.service.d.ts +31 -0
- package/lib/services/entity.service.js +185 -0
- package/lib/services/paymentMethod.service.d.ts +15 -0
- package/lib/services/paymentMethod.service.js +64 -0
- package/lib/services/recurringPayment.service.d.ts +43 -0
- package/lib/services/recurringPayment.service.js +26 -0
- package/lib/services/transaction.service.d.ts +43 -0
- package/lib/services/transaction.service.js +46 -0
- package/lib/transaction.d.ts +4 -0
- package/lib/transaction.js +20 -0
- package/lib/types/budget.type.d.ts +5 -0
- package/lib/types/budget.type.js +2 -0
- package/lib/types/category.type.d.ts +6 -0
- package/lib/types/category.type.js +2 -0
- package/lib/types/common.d.ts +15 -0
- package/lib/types/common.js +2 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/index.js +22 -0
- package/lib/types/interfaces/index.d.ts +3 -0
- package/lib/types/interfaces/index.js +19 -0
- package/lib/types/interfaces/query.interface.d.ts +14 -0
- package/lib/types/interfaces/query.interface.js +2 -0
- package/lib/types/interfaces/recurringPayment.interface.d.ts +5 -0
- package/lib/types/interfaces/recurringPayment.interface.js +2 -0
- package/lib/types/interfaces/transaction.interface.d.ts +5 -0
- package/lib/types/interfaces/transaction.interface.js +2 -0
- package/lib/types/paymentMethod.type.d.ts +5 -0
- package/lib/types/paymentMethod.type.js +2 -0
- package/lib/types/recurringPayment.type.d.ts +5 -0
- package/lib/types/recurringPayment.type.js +2 -0
- package/lib/types/schemas/budget.schema.d.ts +228 -0
- package/lib/types/schemas/budget.schema.js +77 -0
- package/lib/types/schemas/category.schema.d.ts +160 -0
- package/lib/types/schemas/category.schema.js +69 -0
- package/lib/types/schemas/common.schema.d.ts +25 -0
- package/lib/types/schemas/common.schema.js +27 -0
- package/lib/types/schemas/index.d.ts +6 -0
- package/lib/types/schemas/index.js +22 -0
- package/lib/types/schemas/paymentMethod.schema.d.ts +138 -0
- package/lib/types/schemas/paymentMethod.schema.js +59 -0
- package/lib/types/schemas/recurringPayment.schema.d.ts +199 -0
- package/lib/types/schemas/recurringPayment.schema.js +62 -0
- package/lib/types/schemas/transaction.schema.d.ts +207 -0
- package/lib/types/schemas/transaction.schema.js +76 -0
- package/lib/types/transaction.type.d.ts +6 -0
- package/lib/types/transaction.type.js +2 -0
- package/package.json +144 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TypeOfSchema } from "./common";
|
|
2
|
+
import type * as schema from "./schemas/category.schema";
|
|
3
|
+
export type TCategory = TypeOfSchema<typeof schema.Category>;
|
|
4
|
+
export type TCreateOrUpdateCategoryPayload = TypeOfSchema<typeof schema.CreateOrUpdateCategoryPayload>;
|
|
5
|
+
export type TCategoryVH = TypeOfSchema<typeof schema.CategoryVH>;
|
|
6
|
+
export type TCategoryStats = TypeOfSchema<typeof schema.CategoryStats>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type z from "zod";
|
|
2
|
+
import type { UserID } from "./schemas/common.schema";
|
|
3
|
+
export type TypeOfSchema<Schema extends z.ZodType> = z.infer<Schema>;
|
|
4
|
+
/**
|
|
5
|
+
* Type helper to extract the API response type from a schema extending `ApiResponse`.
|
|
6
|
+
*/
|
|
7
|
+
export type TApiResponse<Schema extends z.ZodObject> = TypeOfSchema<Schema>;
|
|
8
|
+
/**
|
|
9
|
+
* Type helper to create branded UserID strings.
|
|
10
|
+
*/
|
|
11
|
+
export type TUserID = TypeOfSchema<typeof UserID>;
|
|
12
|
+
/**
|
|
13
|
+
* Type helper to represent a result that can either be a success or an error.
|
|
14
|
+
*/
|
|
15
|
+
export type TResult<T, E extends Error = Error> = [T, null] | [null, E];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./budget.type"), exports);
|
|
18
|
+
__exportStar(require("./category.type"), exports);
|
|
19
|
+
__exportStar(require("./common"), exports);
|
|
20
|
+
__exportStar(require("./paymentMethod.type"), exports);
|
|
21
|
+
__exportStar(require("./recurringPayment.type"), exports);
|
|
22
|
+
__exportStar(require("./transaction.type"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./query.interface"), exports);
|
|
18
|
+
__exportStar(require("./recurringPayment.interface"), exports);
|
|
19
|
+
__exportStar(require("./transaction.interface"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IBaseGetAllQuery {
|
|
2
|
+
/**
|
|
3
|
+
* Optional search string to filter results.
|
|
4
|
+
*/
|
|
5
|
+
search?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Optional starting index for pagination.
|
|
8
|
+
*/
|
|
9
|
+
from?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Optional ending index for pagination.
|
|
12
|
+
*/
|
|
13
|
+
to?: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TypeOfSchema } from "./common";
|
|
2
|
+
import type * as schema from "./schemas/paymentMethod.schema";
|
|
3
|
+
export type TPaymentMethod = TypeOfSchema<typeof schema.PaymentMethod>;
|
|
4
|
+
export type TCreateOrUpdatePaymentMethodPayload = TypeOfSchema<typeof schema.CreateOrUpdatePaymentMethodPayload>;
|
|
5
|
+
export type TPaymentMethodVH = TypeOfSchema<typeof schema.PaymentMethodVH>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TypeOfSchema } from "./common";
|
|
2
|
+
import type * as schema from "./schemas/recurringPayment.schema";
|
|
3
|
+
export type TRecurringPayment = TypeOfSchema<typeof schema.RecurringPayment>;
|
|
4
|
+
export type TExpandedRecurringPayment = TypeOfSchema<typeof schema.ExpandedRecurringPayment>;
|
|
5
|
+
export type TCreateOrUpdateRecurringPaymentPayload = TypeOfSchema<typeof schema.CreateOrUpdateRecurringPaymentPayload>;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const BudgetType: z.ZodEnum<{
|
|
3
|
+
i: "i";
|
|
4
|
+
e: "e";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const Budget: z.ZodObject<{
|
|
7
|
+
id: z.ZodUUID;
|
|
8
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
9
|
+
type: z.ZodEnum<{
|
|
10
|
+
i: "i";
|
|
11
|
+
e: "e";
|
|
12
|
+
}>;
|
|
13
|
+
budget: z.ZodNumber;
|
|
14
|
+
balance: z.ZodNumber;
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
createdAt: z.ZodISODateTime;
|
|
18
|
+
updatedAt: z.ZodISODateTime;
|
|
19
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
20
|
+
budgetId: z.ZodUUID;
|
|
21
|
+
categoryId: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
22
|
+
category: z.ZodObject<{
|
|
23
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
24
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
description: z.ZodNullable<z.ZodString>;
|
|
27
|
+
createdAt: z.ZodISODateTime;
|
|
28
|
+
updatedAt: z.ZodISODateTime;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export declare const CreateOrUpdateBudgetPayload: z.ZodObject<{
|
|
33
|
+
type: z.ZodEnum<{
|
|
34
|
+
i: "i";
|
|
35
|
+
e: "e";
|
|
36
|
+
}>;
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
budget: z.ZodNumber;
|
|
39
|
+
categories: z.ZodArray<z.core.$ZodBranded<z.ZodUUID, "CategoryID">>;
|
|
40
|
+
description: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export declare const EstimatedBudget: z.ZodObject<{
|
|
43
|
+
expenses: z.ZodObject<{
|
|
44
|
+
paid: z.ZodNumber;
|
|
45
|
+
upcoming: z.ZodNumber;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
income: z.ZodObject<{
|
|
48
|
+
received: z.ZodNumber;
|
|
49
|
+
upcoming: z.ZodNumber;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
freeAmount: z.ZodNumber;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export declare const GetAllBudgetsResponse: z.ZodObject<{
|
|
54
|
+
status: z.ZodNumber;
|
|
55
|
+
message: z.ZodOptional<z.ZodString>;
|
|
56
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
58
|
+
db: "db";
|
|
59
|
+
cache: "cache";
|
|
60
|
+
external: "external";
|
|
61
|
+
}>>;
|
|
62
|
+
data: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
63
|
+
id: z.ZodUUID;
|
|
64
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
65
|
+
type: z.ZodEnum<{
|
|
66
|
+
i: "i";
|
|
67
|
+
e: "e";
|
|
68
|
+
}>;
|
|
69
|
+
budget: z.ZodNumber;
|
|
70
|
+
balance: z.ZodNumber;
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
createdAt: z.ZodISODateTime;
|
|
74
|
+
updatedAt: z.ZodISODateTime;
|
|
75
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
76
|
+
budgetId: z.ZodUUID;
|
|
77
|
+
categoryId: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
78
|
+
category: z.ZodObject<{
|
|
79
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
80
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
description: z.ZodNullable<z.ZodString>;
|
|
83
|
+
createdAt: z.ZodISODateTime;
|
|
84
|
+
updatedAt: z.ZodISODateTime;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
}, z.core.$strip>>>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export declare const GetBudgetResponse: z.ZodObject<{
|
|
90
|
+
status: z.ZodNumber;
|
|
91
|
+
message: z.ZodOptional<z.ZodString>;
|
|
92
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
db: "db";
|
|
95
|
+
cache: "cache";
|
|
96
|
+
external: "external";
|
|
97
|
+
}>>;
|
|
98
|
+
data: z.ZodNullable<z.ZodObject<{
|
|
99
|
+
id: z.ZodUUID;
|
|
100
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
101
|
+
type: z.ZodEnum<{
|
|
102
|
+
i: "i";
|
|
103
|
+
e: "e";
|
|
104
|
+
}>;
|
|
105
|
+
budget: z.ZodNumber;
|
|
106
|
+
balance: z.ZodNumber;
|
|
107
|
+
name: z.ZodString;
|
|
108
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
109
|
+
createdAt: z.ZodISODateTime;
|
|
110
|
+
updatedAt: z.ZodISODateTime;
|
|
111
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
112
|
+
budgetId: z.ZodUUID;
|
|
113
|
+
categoryId: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
114
|
+
category: z.ZodObject<{
|
|
115
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
116
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
117
|
+
name: z.ZodString;
|
|
118
|
+
description: z.ZodNullable<z.ZodString>;
|
|
119
|
+
createdAt: z.ZodISODateTime;
|
|
120
|
+
updatedAt: z.ZodISODateTime;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
}, z.core.$strip>>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
export declare const CreateBudgetResponse: z.ZodObject<{
|
|
126
|
+
status: z.ZodNumber;
|
|
127
|
+
message: z.ZodOptional<z.ZodString>;
|
|
128
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
130
|
+
db: "db";
|
|
131
|
+
cache: "cache";
|
|
132
|
+
external: "external";
|
|
133
|
+
}>>;
|
|
134
|
+
data: z.ZodObject<{
|
|
135
|
+
id: z.ZodUUID;
|
|
136
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
137
|
+
type: z.ZodEnum<{
|
|
138
|
+
i: "i";
|
|
139
|
+
e: "e";
|
|
140
|
+
}>;
|
|
141
|
+
budget: z.ZodNumber;
|
|
142
|
+
balance: z.ZodNumber;
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
createdAt: z.ZodISODateTime;
|
|
146
|
+
updatedAt: z.ZodISODateTime;
|
|
147
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
148
|
+
budgetId: z.ZodUUID;
|
|
149
|
+
categoryId: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
150
|
+
category: z.ZodObject<{
|
|
151
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
152
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
description: z.ZodNullable<z.ZodString>;
|
|
155
|
+
createdAt: z.ZodISODateTime;
|
|
156
|
+
updatedAt: z.ZodISODateTime;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
}, z.core.$strip>>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export declare const UpdateBudgetResponse: z.ZodObject<{
|
|
162
|
+
status: z.ZodNumber;
|
|
163
|
+
message: z.ZodOptional<z.ZodString>;
|
|
164
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
db: "db";
|
|
167
|
+
cache: "cache";
|
|
168
|
+
external: "external";
|
|
169
|
+
}>>;
|
|
170
|
+
data: z.ZodObject<{
|
|
171
|
+
id: z.ZodUUID;
|
|
172
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
173
|
+
type: z.ZodEnum<{
|
|
174
|
+
i: "i";
|
|
175
|
+
e: "e";
|
|
176
|
+
}>;
|
|
177
|
+
budget: z.ZodNumber;
|
|
178
|
+
balance: z.ZodNumber;
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
createdAt: z.ZodISODateTime;
|
|
182
|
+
updatedAt: z.ZodISODateTime;
|
|
183
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
184
|
+
budgetId: z.ZodUUID;
|
|
185
|
+
categoryId: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
186
|
+
category: z.ZodObject<{
|
|
187
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
188
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
189
|
+
name: z.ZodString;
|
|
190
|
+
description: z.ZodNullable<z.ZodString>;
|
|
191
|
+
createdAt: z.ZodISODateTime;
|
|
192
|
+
updatedAt: z.ZodISODateTime;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
}, z.core.$strip>>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
export declare const DeleteBudgetResponse: z.ZodObject<{
|
|
198
|
+
status: z.ZodNumber;
|
|
199
|
+
message: z.ZodOptional<z.ZodString>;
|
|
200
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
202
|
+
db: "db";
|
|
203
|
+
cache: "cache";
|
|
204
|
+
external: "external";
|
|
205
|
+
}>>;
|
|
206
|
+
data: z.ZodNull;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
export declare const EstimatedBudgetResponse: z.ZodObject<{
|
|
209
|
+
status: z.ZodNumber;
|
|
210
|
+
message: z.ZodOptional<z.ZodString>;
|
|
211
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
213
|
+
db: "db";
|
|
214
|
+
cache: "cache";
|
|
215
|
+
external: "external";
|
|
216
|
+
}>>;
|
|
217
|
+
data: z.ZodObject<{
|
|
218
|
+
expenses: z.ZodObject<{
|
|
219
|
+
paid: z.ZodNumber;
|
|
220
|
+
upcoming: z.ZodNumber;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
income: z.ZodObject<{
|
|
223
|
+
received: z.ZodNumber;
|
|
224
|
+
upcoming: z.ZodNumber;
|
|
225
|
+
}, z.core.$strip>;
|
|
226
|
+
freeAmount: z.ZodNumber;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EstimatedBudgetResponse = exports.DeleteBudgetResponse = exports.UpdateBudgetResponse = exports.CreateBudgetResponse = exports.GetBudgetResponse = exports.GetAllBudgetsResponse = exports.EstimatedBudget = exports.CreateOrUpdateBudgetPayload = exports.Budget = exports.BudgetType = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const category_schema_1 = require("./category.schema");
|
|
9
|
+
const common_schema_1 = require("./common.schema");
|
|
10
|
+
exports.BudgetType = zod_1.default.enum(["i", "e"]);
|
|
11
|
+
exports.Budget = zod_1.default.object({
|
|
12
|
+
id: zod_1.default.uuid(),
|
|
13
|
+
ownerId: common_schema_1.UserID,
|
|
14
|
+
type: exports.BudgetType,
|
|
15
|
+
budget: zod_1.default.number().min(0, "The budget must be a positive number"),
|
|
16
|
+
balance: zod_1.default.number(),
|
|
17
|
+
name: zod_1.default.string().min(1).max(40),
|
|
18
|
+
description: zod_1.default.string().max(200).nullable().default(null),
|
|
19
|
+
createdAt: zod_1.default.iso.datetime(),
|
|
20
|
+
updatedAt: zod_1.default.iso.datetime(),
|
|
21
|
+
categories: zod_1.default.array(zod_1.default.object({
|
|
22
|
+
budgetId: zod_1.default.uuid(),
|
|
23
|
+
categoryId: category_schema_1.Category.shape.id,
|
|
24
|
+
category: category_schema_1.Category,
|
|
25
|
+
})),
|
|
26
|
+
});
|
|
27
|
+
// export const CreateBudgetPayload = Budget.pick({
|
|
28
|
+
// type: true,
|
|
29
|
+
// budget: true,
|
|
30
|
+
// name: true,
|
|
31
|
+
// description: true,
|
|
32
|
+
// }).extend({
|
|
33
|
+
// categories: z.array(Category.shape.id),
|
|
34
|
+
// });
|
|
35
|
+
// export const UpdateBudgetPayload = z.object({
|
|
36
|
+
// type: Budget.shape.type.optional(),
|
|
37
|
+
// budget: Budget.shape.budget.optional(),
|
|
38
|
+
// name: Budget.shape.name.optional(),
|
|
39
|
+
// description: Budget.shape.description.optional(),
|
|
40
|
+
// categories: z.array(Category.shape.id).optional(),
|
|
41
|
+
// });
|
|
42
|
+
exports.CreateOrUpdateBudgetPayload = exports.Budget.pick({
|
|
43
|
+
type: true,
|
|
44
|
+
name: true,
|
|
45
|
+
description: true,
|
|
46
|
+
budget: true,
|
|
47
|
+
}).extend({
|
|
48
|
+
categories: zod_1.default.array(category_schema_1.Category.shape.id),
|
|
49
|
+
description: exports.Budget.shape.description.optional(),
|
|
50
|
+
});
|
|
51
|
+
exports.EstimatedBudget = zod_1.default.object({
|
|
52
|
+
expenses: zod_1.default.object({
|
|
53
|
+
paid: zod_1.default.number(),
|
|
54
|
+
upcoming: zod_1.default.number(),
|
|
55
|
+
}),
|
|
56
|
+
income: zod_1.default.object({
|
|
57
|
+
received: zod_1.default.number(),
|
|
58
|
+
upcoming: zod_1.default.number(),
|
|
59
|
+
}),
|
|
60
|
+
freeAmount: zod_1.default.number(),
|
|
61
|
+
});
|
|
62
|
+
exports.GetAllBudgetsResponse = common_schema_1.ApiResponse.extend({
|
|
63
|
+
data: zod_1.default.array(exports.Budget).nullable(),
|
|
64
|
+
});
|
|
65
|
+
exports.GetBudgetResponse = common_schema_1.ApiResponse.extend({
|
|
66
|
+
data: exports.Budget.nullable(),
|
|
67
|
+
});
|
|
68
|
+
exports.CreateBudgetResponse = common_schema_1.ApiResponse.extend({
|
|
69
|
+
data: exports.Budget,
|
|
70
|
+
});
|
|
71
|
+
exports.UpdateBudgetResponse = exports.CreateBudgetResponse;
|
|
72
|
+
exports.DeleteBudgetResponse = common_schema_1.ApiResponse.extend({
|
|
73
|
+
data: zod_1.default.null(),
|
|
74
|
+
});
|
|
75
|
+
exports.EstimatedBudgetResponse = common_schema_1.ApiResponse.extend({
|
|
76
|
+
data: exports.EstimatedBudget,
|
|
77
|
+
});
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const Category: z.ZodObject<{
|
|
3
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
4
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
description: z.ZodNullable<z.ZodString>;
|
|
7
|
+
createdAt: z.ZodISODateTime;
|
|
8
|
+
updatedAt: z.ZodISODateTime;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const CreateOrUpdateCategoryPayload: z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const CategoryVH: z.ZodObject<{
|
|
15
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
16
|
+
description: z.ZodNullable<z.ZodString>;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const CategoryStats: z.ZodObject<{
|
|
20
|
+
from: z.ZodCoercedDate<unknown>;
|
|
21
|
+
to: z.ZodCoercedDate<unknown>;
|
|
22
|
+
stats: z.ZodArray<z.ZodObject<{
|
|
23
|
+
balance: z.ZodNumber;
|
|
24
|
+
income: z.ZodNumber;
|
|
25
|
+
expenses: z.ZodNumber;
|
|
26
|
+
category: z.ZodObject<{
|
|
27
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
28
|
+
description: z.ZodNullable<z.ZodString>;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const GetAllCategoriesResponse: z.ZodObject<{
|
|
34
|
+
status: z.ZodNumber;
|
|
35
|
+
message: z.ZodOptional<z.ZodString>;
|
|
36
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
db: "db";
|
|
39
|
+
cache: "cache";
|
|
40
|
+
external: "external";
|
|
41
|
+
}>>;
|
|
42
|
+
data: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
44
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
description: z.ZodNullable<z.ZodString>;
|
|
47
|
+
createdAt: z.ZodISODateTime;
|
|
48
|
+
updatedAt: z.ZodISODateTime;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export declare const GetCategoryResponse: z.ZodObject<{
|
|
52
|
+
status: z.ZodNumber;
|
|
53
|
+
message: z.ZodOptional<z.ZodString>;
|
|
54
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
db: "db";
|
|
57
|
+
cache: "cache";
|
|
58
|
+
external: "external";
|
|
59
|
+
}>>;
|
|
60
|
+
data: z.ZodNullable<z.ZodObject<{
|
|
61
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
62
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
description: z.ZodNullable<z.ZodString>;
|
|
65
|
+
createdAt: z.ZodISODateTime;
|
|
66
|
+
updatedAt: z.ZodISODateTime;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const CreateCategoryResponse: z.ZodObject<{
|
|
70
|
+
status: z.ZodNumber;
|
|
71
|
+
message: z.ZodOptional<z.ZodString>;
|
|
72
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
db: "db";
|
|
75
|
+
cache: "cache";
|
|
76
|
+
external: "external";
|
|
77
|
+
}>>;
|
|
78
|
+
data: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
79
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
80
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
description: z.ZodNullable<z.ZodString>;
|
|
83
|
+
createdAt: z.ZodISODateTime;
|
|
84
|
+
updatedAt: z.ZodISODateTime;
|
|
85
|
+
}, z.core.$strip>>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export declare const UpdateCategoryResponse: z.ZodObject<{
|
|
88
|
+
status: z.ZodNumber;
|
|
89
|
+
message: z.ZodOptional<z.ZodString>;
|
|
90
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
db: "db";
|
|
93
|
+
cache: "cache";
|
|
94
|
+
external: "external";
|
|
95
|
+
}>>;
|
|
96
|
+
data: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
97
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
98
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
99
|
+
name: z.ZodString;
|
|
100
|
+
description: z.ZodNullable<z.ZodString>;
|
|
101
|
+
createdAt: z.ZodISODateTime;
|
|
102
|
+
updatedAt: z.ZodISODateTime;
|
|
103
|
+
}, z.core.$strip>>>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export declare const DeleteCategoryResponse: z.ZodObject<{
|
|
106
|
+
status: z.ZodNumber;
|
|
107
|
+
message: z.ZodOptional<z.ZodString>;
|
|
108
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
110
|
+
db: "db";
|
|
111
|
+
cache: "cache";
|
|
112
|
+
external: "external";
|
|
113
|
+
}>>;
|
|
114
|
+
data: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
116
|
+
ownerId: z.core.$ZodBranded<z.ZodString, "UserID">;
|
|
117
|
+
name: z.ZodString;
|
|
118
|
+
description: z.ZodNullable<z.ZodString>;
|
|
119
|
+
createdAt: z.ZodISODateTime;
|
|
120
|
+
updatedAt: z.ZodISODateTime;
|
|
121
|
+
}, z.core.$strip>>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export declare const CategoryStatsResponse: z.ZodObject<{
|
|
124
|
+
status: z.ZodNumber;
|
|
125
|
+
message: z.ZodOptional<z.ZodString>;
|
|
126
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
128
|
+
db: "db";
|
|
129
|
+
cache: "cache";
|
|
130
|
+
external: "external";
|
|
131
|
+
}>>;
|
|
132
|
+
data: z.ZodObject<{
|
|
133
|
+
from: z.ZodCoercedDate<unknown>;
|
|
134
|
+
to: z.ZodCoercedDate<unknown>;
|
|
135
|
+
stats: z.ZodArray<z.ZodObject<{
|
|
136
|
+
balance: z.ZodNumber;
|
|
137
|
+
income: z.ZodNumber;
|
|
138
|
+
expenses: z.ZodNumber;
|
|
139
|
+
category: z.ZodObject<{
|
|
140
|
+
id: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
141
|
+
description: z.ZodNullable<z.ZodString>;
|
|
142
|
+
name: z.ZodString;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
export declare const MergeCategoriesResponse: z.ZodObject<{
|
|
148
|
+
status: z.ZodNumber;
|
|
149
|
+
message: z.ZodOptional<z.ZodString>;
|
|
150
|
+
totalCount: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
from: z.ZodOptional<z.ZodEnum<{
|
|
152
|
+
db: "db";
|
|
153
|
+
cache: "cache";
|
|
154
|
+
external: "external";
|
|
155
|
+
}>>;
|
|
156
|
+
data: z.ZodObject<{
|
|
157
|
+
source: z.ZodPipe<z.ZodArray<z.core.$ZodBranded<z.ZodUUID, "CategoryID">>, z.ZodTransform<Set<string & z.core.$brand<"CategoryID">>, (string & z.core.$brand<"CategoryID">)[]>>;
|
|
158
|
+
target: z.core.$ZodBranded<z.ZodUUID, "CategoryID">;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
}, z.core.$strip>;
|