telegram-jobs-contract 1.0.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/README.md +73 -0
- package/dist/contracts/bundles.contract.d.ts +183 -0
- package/dist/contracts/bundles.contract.d.ts.map +1 -0
- package/dist/contracts/bundles.contract.js +29 -0
- package/dist/contracts/channels.contract.d.ts +947 -0
- package/dist/contracts/channels.contract.d.ts.map +1 -0
- package/dist/contracts/channels.contract.js +114 -0
- package/dist/contracts/jobs.contract.d.ts +939 -0
- package/dist/contracts/jobs.contract.d.ts.map +1 -0
- package/dist/contracts/jobs.contract.js +69 -0
- package/dist/contracts/notifications.contract.d.ts +725 -0
- package/dist/contracts/notifications.contract.d.ts.map +1 -0
- package/dist/contracts/notifications.contract.js +65 -0
- package/dist/contracts/resume.contract.d.ts +87 -0
- package/dist/contracts/resume.contract.d.ts.map +1 -0
- package/dist/contracts/resume.contract.js +26 -0
- package/dist/contracts/sniper.contract.d.ts +108 -0
- package/dist/contracts/sniper.contract.d.ts.map +1 -0
- package/dist/contracts/sniper.contract.js +27 -0
- package/dist/contracts/stats.contract.d.ts +148 -0
- package/dist/contracts/stats.contract.d.ts.map +1 -0
- package/dist/contracts/stats.contract.js +41 -0
- package/dist/contracts/user.contract.d.ts +362 -0
- package/dist/contracts/user.contract.d.ts.map +1 -0
- package/dist/contracts/user.contract.js +31 -0
- package/dist/index.d.ts +3504 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/schemas/bundles.d.ts +33 -0
- package/dist/schemas/bundles.d.ts.map +1 -0
- package/dist/schemas/bundles.js +15 -0
- package/dist/schemas/channels.d.ts +134 -0
- package/dist/schemas/channels.d.ts.map +1 -0
- package/dist/schemas/channels.js +25 -0
- package/dist/schemas/common.d.ts +12 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +8 -0
- package/dist/schemas/errors.d.ts +29 -0
- package/dist/schemas/errors.d.ts.map +1 -0
- package/dist/schemas/errors.js +17 -0
- package/dist/schemas/jobs.d.ts +563 -0
- package/dist/schemas/jobs.d.ts.map +1 -0
- package/dist/schemas/jobs.js +64 -0
- package/dist/schemas/user.d.ts +262 -0
- package/dist/schemas/user.d.ts.map +1 -0
- package/dist/schemas/user.js +36 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Telegram Jobs Contract
|
|
2
|
+
|
|
3
|
+
Shared API contract for telegram-jobs application using [ts-rest](https://ts-rest.com/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @werty-potom/telegram-jobs-contract
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Server (Express)
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { initServer } from '@ts-rest/express';
|
|
17
|
+
import { jobsContract } from '@werty-potom/telegram-jobs-contract';
|
|
18
|
+
|
|
19
|
+
const s = initServer();
|
|
20
|
+
|
|
21
|
+
const jobRouter = s.router(jobsContract, {
|
|
22
|
+
searchJobs: async ({ body }) => {
|
|
23
|
+
// Implementation
|
|
24
|
+
return {
|
|
25
|
+
status: 200,
|
|
26
|
+
body: {
|
|
27
|
+
success: true,
|
|
28
|
+
message: 'Jobs retrieved',
|
|
29
|
+
data: { jobs: [], total: 0, limit: 20, offset: 0 },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
// ... other routes
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Client (React + React Query)
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { initQueryClient } from '@ts-rest/react-query';
|
|
41
|
+
import { apiContract } from '@werty-potom/telegram-jobs-contract';
|
|
42
|
+
|
|
43
|
+
export const api = initQueryClient(apiContract, {
|
|
44
|
+
baseUrl: 'http://localhost:4000',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Usage in components
|
|
48
|
+
const { data } = api.jobs.searchJobs.useQuery({
|
|
49
|
+
body: { filters: {}, pagination: {} },
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Contracts
|
|
54
|
+
|
|
55
|
+
- `jobs` - Job search and management
|
|
56
|
+
- `channels` - Channel subscriptions
|
|
57
|
+
- `user` - User preferences
|
|
58
|
+
- `resume` - Resume upload
|
|
59
|
+
- `sniper` - Tailored resume generation
|
|
60
|
+
- `notifications` - Notification settings
|
|
61
|
+
- `stats` - Platform statistics
|
|
62
|
+
- `feedback` - User feedback
|
|
63
|
+
- `bundles` - Channel bundles
|
|
64
|
+
|
|
65
|
+
## Publishing
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm run publish # Builds, versions, and publishes to GitHub Packages
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const bundlesContract: {
|
|
3
|
+
getAllBundles: {
|
|
4
|
+
summary: "Get all channel bundles";
|
|
5
|
+
method: "GET";
|
|
6
|
+
path: "/api/bundles";
|
|
7
|
+
responses: {
|
|
8
|
+
200: z.ZodObject<{
|
|
9
|
+
success: z.ZodLiteral<true>;
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
data: z.ZodArray<z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
description: z.ZodOptional<z.ZodString>;
|
|
15
|
+
channels: z.ZodArray<z.ZodString, "many">;
|
|
16
|
+
category: z.ZodOptional<z.ZodString>;
|
|
17
|
+
isActive: z.ZodBoolean;
|
|
18
|
+
order: z.ZodNumber;
|
|
19
|
+
createdAt: z.ZodString;
|
|
20
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
id: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
isActive: boolean;
|
|
25
|
+
name: string;
|
|
26
|
+
channels: string[];
|
|
27
|
+
order: number;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
updatedAt?: string | undefined;
|
|
30
|
+
category?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
id: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
isActive: boolean;
|
|
35
|
+
name: string;
|
|
36
|
+
channels: string[];
|
|
37
|
+
order: number;
|
|
38
|
+
description?: string | undefined;
|
|
39
|
+
updatedAt?: string | undefined;
|
|
40
|
+
category?: string | undefined;
|
|
41
|
+
}>, "many">;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
message: string;
|
|
44
|
+
success: true;
|
|
45
|
+
data: {
|
|
46
|
+
id: string;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
isActive: boolean;
|
|
49
|
+
name: string;
|
|
50
|
+
channels: string[];
|
|
51
|
+
order: number;
|
|
52
|
+
description?: string | undefined;
|
|
53
|
+
updatedAt?: string | undefined;
|
|
54
|
+
category?: string | undefined;
|
|
55
|
+
}[];
|
|
56
|
+
}, {
|
|
57
|
+
message: string;
|
|
58
|
+
success: true;
|
|
59
|
+
data: {
|
|
60
|
+
id: string;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
isActive: boolean;
|
|
63
|
+
name: string;
|
|
64
|
+
channels: string[];
|
|
65
|
+
order: number;
|
|
66
|
+
description?: string | undefined;
|
|
67
|
+
updatedAt?: string | undefined;
|
|
68
|
+
category?: string | undefined;
|
|
69
|
+
}[];
|
|
70
|
+
}>;
|
|
71
|
+
500: z.ZodObject<{
|
|
72
|
+
success: z.ZodLiteral<false>;
|
|
73
|
+
message: z.ZodString;
|
|
74
|
+
errors: z.ZodOptional<z.ZodAny>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
message: string;
|
|
77
|
+
success: false;
|
|
78
|
+
errors?: any;
|
|
79
|
+
}, {
|
|
80
|
+
message: string;
|
|
81
|
+
success: false;
|
|
82
|
+
errors?: any;
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
getBundleById: {
|
|
87
|
+
summary: "Get bundle by ID";
|
|
88
|
+
method: "GET";
|
|
89
|
+
path: "/api/bundles/:id";
|
|
90
|
+
responses: {
|
|
91
|
+
200: z.ZodObject<{
|
|
92
|
+
success: z.ZodLiteral<true>;
|
|
93
|
+
message: z.ZodString;
|
|
94
|
+
data: z.ZodObject<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
description: z.ZodOptional<z.ZodString>;
|
|
98
|
+
channels: z.ZodArray<z.ZodString, "many">;
|
|
99
|
+
category: z.ZodOptional<z.ZodString>;
|
|
100
|
+
isActive: z.ZodBoolean;
|
|
101
|
+
order: z.ZodNumber;
|
|
102
|
+
createdAt: z.ZodString;
|
|
103
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
id: string;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
isActive: boolean;
|
|
108
|
+
name: string;
|
|
109
|
+
channels: string[];
|
|
110
|
+
order: number;
|
|
111
|
+
description?: string | undefined;
|
|
112
|
+
updatedAt?: string | undefined;
|
|
113
|
+
category?: string | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
isActive: boolean;
|
|
118
|
+
name: string;
|
|
119
|
+
channels: string[];
|
|
120
|
+
order: number;
|
|
121
|
+
description?: string | undefined;
|
|
122
|
+
updatedAt?: string | undefined;
|
|
123
|
+
category?: string | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
message: string;
|
|
127
|
+
success: true;
|
|
128
|
+
data: {
|
|
129
|
+
id: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
isActive: boolean;
|
|
132
|
+
name: string;
|
|
133
|
+
channels: string[];
|
|
134
|
+
order: number;
|
|
135
|
+
description?: string | undefined;
|
|
136
|
+
updatedAt?: string | undefined;
|
|
137
|
+
category?: string | undefined;
|
|
138
|
+
};
|
|
139
|
+
}, {
|
|
140
|
+
message: string;
|
|
141
|
+
success: true;
|
|
142
|
+
data: {
|
|
143
|
+
id: string;
|
|
144
|
+
createdAt: string;
|
|
145
|
+
isActive: boolean;
|
|
146
|
+
name: string;
|
|
147
|
+
channels: string[];
|
|
148
|
+
order: number;
|
|
149
|
+
description?: string | undefined;
|
|
150
|
+
updatedAt?: string | undefined;
|
|
151
|
+
category?: string | undefined;
|
|
152
|
+
};
|
|
153
|
+
}>;
|
|
154
|
+
404: z.ZodObject<{
|
|
155
|
+
success: z.ZodLiteral<false>;
|
|
156
|
+
message: z.ZodString;
|
|
157
|
+
errors: z.ZodOptional<z.ZodAny>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
message: string;
|
|
160
|
+
success: false;
|
|
161
|
+
errors?: any;
|
|
162
|
+
}, {
|
|
163
|
+
message: string;
|
|
164
|
+
success: false;
|
|
165
|
+
errors?: any;
|
|
166
|
+
}>;
|
|
167
|
+
500: z.ZodObject<{
|
|
168
|
+
success: z.ZodLiteral<false>;
|
|
169
|
+
message: z.ZodString;
|
|
170
|
+
errors: z.ZodOptional<z.ZodAny>;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
message: string;
|
|
173
|
+
success: false;
|
|
174
|
+
errors?: any;
|
|
175
|
+
}, {
|
|
176
|
+
message: string;
|
|
177
|
+
success: false;
|
|
178
|
+
errors?: any;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=bundles.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundles.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/bundles.contract.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqB1B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bundlesContract = void 0;
|
|
4
|
+
const core_1 = require("@ts-rest/core");
|
|
5
|
+
const bundles_1 = require("../schemas/bundles");
|
|
6
|
+
const errors_1 = require("../schemas/errors");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const c = (0, core_1.initContract)();
|
|
9
|
+
exports.bundlesContract = c.router({
|
|
10
|
+
getAllBundles: {
|
|
11
|
+
method: 'GET',
|
|
12
|
+
path: '/api/bundles',
|
|
13
|
+
responses: {
|
|
14
|
+
200: (0, errors_1.SuccessResponseSchema)(zod_1.z.array(bundles_1.BundleSchema)),
|
|
15
|
+
500: errors_1.ErrorResponseSchema,
|
|
16
|
+
},
|
|
17
|
+
summary: 'Get all channel bundles',
|
|
18
|
+
},
|
|
19
|
+
getBundleById: {
|
|
20
|
+
method: 'GET',
|
|
21
|
+
path: '/api/bundles/:id',
|
|
22
|
+
responses: {
|
|
23
|
+
200: (0, errors_1.SuccessResponseSchema)(bundles_1.BundleSchema),
|
|
24
|
+
404: errors_1.ErrorResponseSchema,
|
|
25
|
+
500: errors_1.ErrorResponseSchema,
|
|
26
|
+
},
|
|
27
|
+
summary: 'Get bundle by ID',
|
|
28
|
+
},
|
|
29
|
+
});
|