@gigapay-dev/contracts 1.1.6 → 1.1.7
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.
|
@@ -9,6 +9,7 @@ const login_1 = require("./login");
|
|
|
9
9
|
const register_1 = require("./register");
|
|
10
10
|
const confirm_1 = require("./confirm");
|
|
11
11
|
const reset_1 = require("./reset");
|
|
12
|
+
const profile_1 = require("./profile");
|
|
12
13
|
exports.AuthEndpoints = {
|
|
13
14
|
login: {
|
|
14
15
|
method: "POST",
|
|
@@ -39,5 +40,11 @@ exports.AuthEndpoints = {
|
|
|
39
40
|
path: "/auth/confirm-code/:code",
|
|
40
41
|
request: confirm_1.ConfirmCodeRequestSchema,
|
|
41
42
|
response: login_1.UserLoginResponseSchema,
|
|
43
|
+
},
|
|
44
|
+
profile: {
|
|
45
|
+
method: "GET",
|
|
46
|
+
path: "/auth/profile",
|
|
47
|
+
request: zod_1.default.void(),
|
|
48
|
+
response: profile_1.UserProfileResponseSchema,
|
|
42
49
|
}
|
|
43
50
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserProfileResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserProfileResponseSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.coerce.number(),
|
|
7
|
+
username: zod_1.z.string(),
|
|
8
|
+
email: zod_1.z.string(),
|
|
9
|
+
avatar: zod_1.z.string().nullable(),
|
|
10
|
+
});
|
|
@@ -7,6 +7,7 @@ exports.OrderEndpoints = void 0;
|
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
const read_1 = require("./read");
|
|
9
9
|
const create_1 = require("./create");
|
|
10
|
+
const pagination_1 = require("../pagination");
|
|
10
11
|
exports.OrderEndpoints = {
|
|
11
12
|
create: {
|
|
12
13
|
method: "POST",
|
|
@@ -17,7 +18,7 @@ exports.OrderEndpoints = {
|
|
|
17
18
|
list: {
|
|
18
19
|
method: "GET",
|
|
19
20
|
path: "/orders",
|
|
20
|
-
request:
|
|
21
|
+
request: pagination_1.PaginationQuery,
|
|
21
22
|
response: zod_1.default.array(read_1.OrderReadResponseSchema),
|
|
22
23
|
},
|
|
23
24
|
getById: {
|
|
@@ -31,7 +32,7 @@ exports.OrderEndpoints = {
|
|
|
31
32
|
getUserOrders: {
|
|
32
33
|
method: "GET",
|
|
33
34
|
path: "/orders/user",
|
|
34
|
-
request:
|
|
35
|
+
request: pagination_1.PaginationQuery,
|
|
35
36
|
response: zod_1.default.array(read_1.OrderReadResponseSchema),
|
|
36
37
|
},
|
|
37
38
|
getUserOrderById: {
|
|
@@ -4,6 +4,7 @@ import { UserRegisterRequestSchema } from "./register";
|
|
|
4
4
|
import { EndpointContract } from "../../types";
|
|
5
5
|
import { ConfirmCodeRequestSchema } from "./confirm";
|
|
6
6
|
import { UserResetRequestSchema } from "./reset";
|
|
7
|
+
import { UserProfileResponseSchema } from "./profile";
|
|
7
8
|
|
|
8
9
|
export const AuthEndpoints = {
|
|
9
10
|
login: {
|
|
@@ -35,6 +36,12 @@ export const AuthEndpoints = {
|
|
|
35
36
|
path: "/auth/confirm-code/:code",
|
|
36
37
|
request: ConfirmCodeRequestSchema,
|
|
37
38
|
response: UserLoginResponseSchema,
|
|
39
|
+
},
|
|
40
|
+
profile: {
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: "/auth/profile",
|
|
43
|
+
request: z.void(),
|
|
44
|
+
response: UserProfileResponseSchema,
|
|
38
45
|
}
|
|
39
46
|
} satisfies Record<string, EndpointContract>;
|
|
40
47
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const UserProfileResponseSchema = z.object({
|
|
4
|
+
id: z.coerce.number(),
|
|
5
|
+
username: z.string(),
|
|
6
|
+
email: z.string(),
|
|
7
|
+
avatar: z.string().nullable(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type UserProfileResponse = z.infer<typeof UserProfileResponseSchema>;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { EndpointContract } from "../../types";
|
|
8
8
|
import { OrderCreateRequestSchema, OrderCreateResponseSchema } from "./create";
|
|
9
|
+
import { PaginationQuery } from "../pagination";
|
|
9
10
|
|
|
10
11
|
export const OrderEndpoints = {
|
|
11
12
|
create: {
|
|
@@ -17,7 +18,7 @@ export const OrderEndpoints = {
|
|
|
17
18
|
list: {
|
|
18
19
|
method: "GET",
|
|
19
20
|
path: "/orders",
|
|
20
|
-
request:
|
|
21
|
+
request: PaginationQuery,
|
|
21
22
|
response: z.array(OrderReadResponseSchema),
|
|
22
23
|
},
|
|
23
24
|
getById: {
|
|
@@ -31,7 +32,7 @@ export const OrderEndpoints = {
|
|
|
31
32
|
getUserOrders: {
|
|
32
33
|
method: "GET",
|
|
33
34
|
path: "/orders/user",
|
|
34
|
-
request:
|
|
35
|
+
request: PaginationQuery,
|
|
35
36
|
response: z.array(OrderReadResponseSchema),
|
|
36
37
|
},
|
|
37
38
|
getUserOrderById: {
|