@venulog/phasing-engine-schemas 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/README.md +67 -0
- package/dist/auth.d.ts +114 -0
- package/dist/auth.js +109 -0
- package/dist/common.d.ts +18 -0
- package/dist/common.js +45 -0
- package/dist/company.d.ts +45 -0
- package/dist/company.js +120 -0
- package/dist/enums/bookingStatus.d.ts +6 -0
- package/dist/enums/bookingStatus.js +7 -0
- package/dist/enums/slotStatus.d.ts +5 -0
- package/dist/enums/slotStatus.js +6 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +12 -0
- package/dist/pagination.d.ts +13 -0
- package/dist/pagination.js +11 -0
- package/dist/phaseBooking.d.ts +701 -0
- package/dist/phaseBooking.js +890 -0
- package/dist/phaseSlot.d.ts +82 -0
- package/dist/phaseSlot.js +74 -0
- package/dist/zod.d.ts +2 -0
- package/dist/zod.js +4 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @phasing-engine/schemas
|
|
2
|
+
|
|
3
|
+
Shared schemas and types for Phasing Engine API. Provides Zod validation schemas, TypeScript types, and OpenAPI documentation support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
This package is designed to be used as a local workspace package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @phasing-engine/schemas
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import {
|
|
17
|
+
phaseBookingSchema,
|
|
18
|
+
PhaseBooking,
|
|
19
|
+
BookingStatus,
|
|
20
|
+
SlotStatus
|
|
21
|
+
} from '@phasing-engine/schemas';
|
|
22
|
+
|
|
23
|
+
// Use schemas for validation
|
|
24
|
+
const booking = phaseBookingSchema.parse(data);
|
|
25
|
+
|
|
26
|
+
// Use types for type safety
|
|
27
|
+
const createBooking = (booking: PhaseBooking) => {
|
|
28
|
+
// ...
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Use enums for status values
|
|
32
|
+
if (booking.status === BookingStatus.CONFIRMED) {
|
|
33
|
+
// ...
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Available Exports
|
|
38
|
+
|
|
39
|
+
### Schemas
|
|
40
|
+
|
|
41
|
+
- `auth` - Authentication related schemas
|
|
42
|
+
- `common` - Base response schemas and factory functions
|
|
43
|
+
- `pagination` - Pagination and sorting schemas
|
|
44
|
+
- `phaseBooking` - Phase booking operation schemas
|
|
45
|
+
- `phaseSlot` - Phase slot management schemas
|
|
46
|
+
|
|
47
|
+
### Enums
|
|
48
|
+
|
|
49
|
+
- `BookingStatus` - Booking status values
|
|
50
|
+
- `SlotStatus` - Slot status values
|
|
51
|
+
|
|
52
|
+
### Types
|
|
53
|
+
|
|
54
|
+
All schemas export corresponding TypeScript types using Zod's `z.infer<>`.
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Build the package
|
|
60
|
+
npm run build
|
|
61
|
+
|
|
62
|
+
# Watch mode for development
|
|
63
|
+
npm run dev
|
|
64
|
+
|
|
65
|
+
# Clean build artifacts
|
|
66
|
+
npm run clean
|
|
67
|
+
```
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
export declare const signInParamsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
3
|
+
export declare const refreshTokenParamsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
4
|
+
export declare const signInBodySchema: z.ZodObject<{
|
|
5
|
+
email: z.ZodEmail;
|
|
6
|
+
password: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const refreshTokenBodySchema: z.ZodObject<{
|
|
9
|
+
refresh_token: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const authUserSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodUUID;
|
|
13
|
+
email: z.ZodEmail;
|
|
14
|
+
email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
created_at: z.ZodString;
|
|
16
|
+
updated_at: z.ZodString;
|
|
17
|
+
user_metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const authSessionSchema: z.ZodObject<{
|
|
20
|
+
access_token: z.ZodString;
|
|
21
|
+
token_type: z.ZodString;
|
|
22
|
+
expires_in: z.ZodNumber;
|
|
23
|
+
expires_at: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
refresh_token: z.ZodOptional<z.ZodString>;
|
|
25
|
+
user: z.ZodObject<{
|
|
26
|
+
id: z.ZodUUID;
|
|
27
|
+
email: z.ZodEmail;
|
|
28
|
+
email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
created_at: z.ZodString;
|
|
30
|
+
updated_at: z.ZodString;
|
|
31
|
+
user_metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare const signOutDataSchema: z.ZodObject<{
|
|
35
|
+
message: z.ZodString;
|
|
36
|
+
signed_out_at: z.ZodString;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare const currentUserDataSchema: z.ZodObject<{
|
|
39
|
+
id: z.ZodUUID;
|
|
40
|
+
email: z.ZodEmail;
|
|
41
|
+
email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
|
+
created_at: z.ZodString;
|
|
43
|
+
updated_at: z.ZodString;
|
|
44
|
+
user_metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export declare const signInResponseSchema: z.ZodObject<{
|
|
47
|
+
success: z.ZodBoolean;
|
|
48
|
+
message: z.ZodString;
|
|
49
|
+
data: z.ZodObject<{
|
|
50
|
+
access_token: z.ZodString;
|
|
51
|
+
token_type: z.ZodString;
|
|
52
|
+
expires_in: z.ZodNumber;
|
|
53
|
+
expires_at: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
refresh_token: z.ZodOptional<z.ZodString>;
|
|
55
|
+
user: z.ZodObject<{
|
|
56
|
+
id: z.ZodUUID;
|
|
57
|
+
email: z.ZodEmail;
|
|
58
|
+
email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
created_at: z.ZodString;
|
|
60
|
+
updated_at: z.ZodString;
|
|
61
|
+
user_metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export declare const refreshTokenResponseSchema: z.ZodObject<{
|
|
66
|
+
success: z.ZodBoolean;
|
|
67
|
+
message: z.ZodString;
|
|
68
|
+
data: z.ZodObject<{
|
|
69
|
+
access_token: z.ZodString;
|
|
70
|
+
token_type: z.ZodString;
|
|
71
|
+
expires_in: z.ZodNumber;
|
|
72
|
+
expires_at: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
refresh_token: z.ZodOptional<z.ZodString>;
|
|
74
|
+
user: z.ZodObject<{
|
|
75
|
+
id: z.ZodUUID;
|
|
76
|
+
email: z.ZodEmail;
|
|
77
|
+
email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
created_at: z.ZodString;
|
|
79
|
+
updated_at: z.ZodString;
|
|
80
|
+
user_metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
export declare const signOutResponseSchema: z.ZodObject<{
|
|
85
|
+
success: z.ZodBoolean;
|
|
86
|
+
message: z.ZodString;
|
|
87
|
+
data: z.ZodObject<{
|
|
88
|
+
message: z.ZodString;
|
|
89
|
+
signed_out_at: z.ZodString;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export declare const getCurrentUserResponseSchema: z.ZodObject<{
|
|
93
|
+
success: z.ZodBoolean;
|
|
94
|
+
data: z.ZodObject<{
|
|
95
|
+
id: z.ZodUUID;
|
|
96
|
+
email: z.ZodEmail;
|
|
97
|
+
email_confirmed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
created_at: z.ZodString;
|
|
99
|
+
updated_at: z.ZodString;
|
|
100
|
+
user_metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type SignInParams = z.infer<typeof signInParamsSchema>;
|
|
104
|
+
export type RefreshTokenParams = z.infer<typeof refreshTokenParamsSchema>;
|
|
105
|
+
export type SignInBody = z.infer<typeof signInBodySchema>;
|
|
106
|
+
export type RefreshTokenBody = z.infer<typeof refreshTokenBodySchema>;
|
|
107
|
+
export type AuthUser = z.infer<typeof authUserSchema>;
|
|
108
|
+
export type AuthSession = z.infer<typeof authSessionSchema>;
|
|
109
|
+
export type SignOutData = z.infer<typeof signOutDataSchema>;
|
|
110
|
+
export type CurrentUserData = z.infer<typeof currentUserDataSchema>;
|
|
111
|
+
export type SignInResponse = z.infer<typeof signInResponseSchema>;
|
|
112
|
+
export type RefreshTokenResponse = z.infer<typeof refreshTokenResponseSchema>;
|
|
113
|
+
export type SignOutResponse = z.infer<typeof signOutResponseSchema>;
|
|
114
|
+
export type GetCurrentUserResponse = z.infer<typeof getCurrentUserResponseSchema>;
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
import { createMessageDataResponseSchema, createSuccessResponseSchema } from './common.js';
|
|
3
|
+
// ------------------------------
|
|
4
|
+
// Parameter schemas
|
|
5
|
+
// ------------------------------
|
|
6
|
+
export const signInParamsSchema = z.object({}).openapi('SignInParams');
|
|
7
|
+
export const refreshTokenParamsSchema = z.object({}).openapi('RefreshTokenParams');
|
|
8
|
+
// ------------------------------
|
|
9
|
+
// Request body schemas
|
|
10
|
+
// ------------------------------
|
|
11
|
+
export const signInBodySchema = z
|
|
12
|
+
.object({
|
|
13
|
+
email: z.email().openapi({
|
|
14
|
+
description: 'User email address',
|
|
15
|
+
example: 'superadmin@venulog.com'
|
|
16
|
+
}),
|
|
17
|
+
password: z.string().min(6).openapi({
|
|
18
|
+
description: 'User password (minimum 6 characters)',
|
|
19
|
+
example: 'password'
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
.openapi('SignInBody');
|
|
23
|
+
export const refreshTokenBodySchema = z
|
|
24
|
+
.object({
|
|
25
|
+
refresh_token: z.string().min(1).openapi({
|
|
26
|
+
description: 'Valid refresh token',
|
|
27
|
+
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
.openapi('RefreshTokenBody');
|
|
31
|
+
// ------------------------------
|
|
32
|
+
// Response data schemas
|
|
33
|
+
// ------------------------------
|
|
34
|
+
export const authUserSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
id: z.uuid().openapi({
|
|
37
|
+
description: 'User unique identifier',
|
|
38
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
39
|
+
}),
|
|
40
|
+
email: z.email().openapi({
|
|
41
|
+
description: 'User email address',
|
|
42
|
+
example: 'superadmin@venulog.com'
|
|
43
|
+
}),
|
|
44
|
+
email_confirmed_at: z.string().nullable().optional().openapi({
|
|
45
|
+
description: 'Timestamp when email was confirmed',
|
|
46
|
+
example: '2025-12-04T10:30:00.000Z'
|
|
47
|
+
}),
|
|
48
|
+
created_at: z.string().openapi({
|
|
49
|
+
description: 'Timestamp when user was created',
|
|
50
|
+
example: '2025-12-04T10:30:00.000Z'
|
|
51
|
+
}),
|
|
52
|
+
updated_at: z.string().openapi({
|
|
53
|
+
description: 'Timestamp when user was last updated',
|
|
54
|
+
example: '2025-12-04T10:30:00.000Z'
|
|
55
|
+
}),
|
|
56
|
+
user_metadata: z
|
|
57
|
+
.record(z.string(), z.unknown())
|
|
58
|
+
.optional()
|
|
59
|
+
.openapi({
|
|
60
|
+
description: 'Additional user metadata',
|
|
61
|
+
example: { first_name: 'John', last_name: 'Doe' }
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
.openapi('AuthUser');
|
|
65
|
+
export const authSessionSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
access_token: z.string().openapi({
|
|
68
|
+
description: 'JWT access token for authenticated requests',
|
|
69
|
+
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
70
|
+
}),
|
|
71
|
+
token_type: z.string().openapi({
|
|
72
|
+
description: 'Type of the token',
|
|
73
|
+
example: 'Bearer'
|
|
74
|
+
}),
|
|
75
|
+
expires_in: z.number().openapi({
|
|
76
|
+
description: 'Token expiration time in seconds',
|
|
77
|
+
example: 3600
|
|
78
|
+
}),
|
|
79
|
+
expires_at: z.number().optional().openapi({
|
|
80
|
+
description: 'Token expiration timestamp',
|
|
81
|
+
example: 1701684600
|
|
82
|
+
}),
|
|
83
|
+
refresh_token: z.string().optional().openapi({
|
|
84
|
+
description: 'Refresh token for obtaining new access tokens',
|
|
85
|
+
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
86
|
+
}),
|
|
87
|
+
user: authUserSchema
|
|
88
|
+
})
|
|
89
|
+
.openapi('AuthSession');
|
|
90
|
+
export const signOutDataSchema = z
|
|
91
|
+
.object({
|
|
92
|
+
message: z.string().openapi({
|
|
93
|
+
description: 'Sign out confirmation message',
|
|
94
|
+
example: 'Successfully signed out'
|
|
95
|
+
}),
|
|
96
|
+
signed_out_at: z.string().openapi({
|
|
97
|
+
description: 'Timestamp when user was signed out',
|
|
98
|
+
example: '2025-12-04T10:30:00.000Z'
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
.openapi('SignOutData');
|
|
102
|
+
export const currentUserDataSchema = authUserSchema.openapi('CurrentUserData');
|
|
103
|
+
// ------------------------------
|
|
104
|
+
// Response schemas
|
|
105
|
+
// ------------------------------
|
|
106
|
+
export const signInResponseSchema = createMessageDataResponseSchema(authSessionSchema, 'SignInResponse', 'Successfully signed in', 'Authentication session with access token and user information');
|
|
107
|
+
export const refreshTokenResponseSchema = createMessageDataResponseSchema(authSessionSchema, 'RefreshTokenResponse', 'Access token refreshed successfully', 'New authentication session with refreshed tokens');
|
|
108
|
+
export const signOutResponseSchema = createMessageDataResponseSchema(signOutDataSchema, 'SignOutResponse', 'Successfully signed out', 'Sign out confirmation details');
|
|
109
|
+
export const getCurrentUserResponseSchema = createSuccessResponseSchema(currentUserDataSchema, 'GetCurrentUserResponse', 'Current authenticated user information');
|
package/dist/common.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
export declare const baseResponseSchema: z.ZodObject<{
|
|
3
|
+
success: z.ZodBoolean;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare function createSuccessResponseSchema<T extends z.ZodTypeAny>(dataSchema: T, schemaName: string, dataDescription?: string): z.ZodObject<{
|
|
6
|
+
success: z.ZodBoolean;
|
|
7
|
+
data: T;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare function createMessageResponseSchema(schemaName: string, messageExample?: string): z.ZodObject<{
|
|
10
|
+
success: z.ZodBoolean;
|
|
11
|
+
message: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare function createMessageDataResponseSchema<T extends z.ZodTypeAny>(dataSchema: T, schemaName: string, messageExample?: string, dataDescription?: string): z.ZodObject<{
|
|
14
|
+
success: z.ZodBoolean;
|
|
15
|
+
message: z.ZodString;
|
|
16
|
+
data: T;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type BaseResponse = z.infer<typeof baseResponseSchema>;
|
package/dist/common.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
// Base response schema for all API responses
|
|
3
|
+
export const baseResponseSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
success: z.boolean().openapi({
|
|
6
|
+
description: 'Indicates if the operation was successful',
|
|
7
|
+
example: true
|
|
8
|
+
})
|
|
9
|
+
})
|
|
10
|
+
.openapi('BaseResponse');
|
|
11
|
+
// Success response with data
|
|
12
|
+
export function createSuccessResponseSchema(dataSchema, schemaName, dataDescription) {
|
|
13
|
+
return baseResponseSchema
|
|
14
|
+
.extend({
|
|
15
|
+
data: dataSchema.openapi({
|
|
16
|
+
description: dataDescription || 'Response data'
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
.openapi(schemaName);
|
|
20
|
+
}
|
|
21
|
+
// Success response with message
|
|
22
|
+
export function createMessageResponseSchema(schemaName, messageExample = 'Operation completed successfully') {
|
|
23
|
+
return baseResponseSchema
|
|
24
|
+
.extend({
|
|
25
|
+
message: z.string().openapi({
|
|
26
|
+
description: 'Human-readable success message',
|
|
27
|
+
example: messageExample
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
.openapi(schemaName);
|
|
31
|
+
}
|
|
32
|
+
// Success response with both message and data
|
|
33
|
+
export function createMessageDataResponseSchema(dataSchema, schemaName, messageExample = 'Operation completed successfully', dataDescription) {
|
|
34
|
+
return baseResponseSchema
|
|
35
|
+
.extend({
|
|
36
|
+
message: z.string().openapi({
|
|
37
|
+
description: 'Human-readable success message',
|
|
38
|
+
example: messageExample
|
|
39
|
+
}),
|
|
40
|
+
data: dataSchema.openapi({
|
|
41
|
+
description: dataDescription || 'Response data'
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
.openapi(schemaName);
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
export declare const fullCompanySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
company_name: z.ZodString;
|
|
5
|
+
vat_number: z.ZodNullable<z.ZodString>;
|
|
6
|
+
siret_code: z.ZodNullable<z.ZodString>;
|
|
7
|
+
tva_intracom: z.ZodNullable<z.ZodString>;
|
|
8
|
+
type: z.ZodString;
|
|
9
|
+
company_role: z.ZodNullable<z.ZodString>;
|
|
10
|
+
company_street: z.ZodNullable<z.ZodString>;
|
|
11
|
+
company_city: z.ZodNullable<z.ZodString>;
|
|
12
|
+
company_postal_code: z.ZodNullable<z.ZodString>;
|
|
13
|
+
company_country: z.ZodNullable<z.ZodString>;
|
|
14
|
+
company_address: z.ZodNullable<z.ZodString>;
|
|
15
|
+
contact_first_name: z.ZodNullable<z.ZodString>;
|
|
16
|
+
contact_last_name: z.ZodNullable<z.ZodString>;
|
|
17
|
+
contact_email: z.ZodNullable<z.ZodString>;
|
|
18
|
+
contact_phone: z.ZodNullable<z.ZodString>;
|
|
19
|
+
is_active: z.ZodBoolean;
|
|
20
|
+
created_at: z.ZodString;
|
|
21
|
+
updated_at: z.ZodString;
|
|
22
|
+
created_by: z.ZodNullable<z.ZodString>;
|
|
23
|
+
updated_by: z.ZodNullable<z.ZodString>;
|
|
24
|
+
company_id: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const companyRoleSchema: z.ZodObject<{
|
|
27
|
+
role: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export declare const companyRolesDataSchema: z.ZodObject<{
|
|
30
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
31
|
+
role: z.ZodString;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare const getCompanyRolesResponseSchema: z.ZodObject<{
|
|
35
|
+
success: z.ZodBoolean;
|
|
36
|
+
data: z.ZodObject<{
|
|
37
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
38
|
+
role: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type FullCompany = z.infer<typeof fullCompanySchema>;
|
|
43
|
+
export type CompanyRole = z.infer<typeof companyRoleSchema>;
|
|
44
|
+
export type CompanyRolesData = z.infer<typeof companyRolesDataSchema>;
|
|
45
|
+
export type GetCompanyRolesResponse = z.infer<typeof getCompanyRolesResponseSchema>;
|
package/dist/company.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
import { createSuccessResponseSchema } from './common.js';
|
|
3
|
+
// ------------------------------
|
|
4
|
+
// Company schemas
|
|
5
|
+
// ------------------------------
|
|
6
|
+
export const fullCompanySchema = z
|
|
7
|
+
.object({
|
|
8
|
+
id: z.number().openapi({
|
|
9
|
+
description: 'Company unique identifier',
|
|
10
|
+
example: 1
|
|
11
|
+
}),
|
|
12
|
+
company_name: z.string().openapi({
|
|
13
|
+
description: 'Company name',
|
|
14
|
+
example: 'Acme Corporation'
|
|
15
|
+
}),
|
|
16
|
+
vat_number: z.string().nullable().openapi({
|
|
17
|
+
description: 'VAT number',
|
|
18
|
+
example: 'FR12345678901'
|
|
19
|
+
}),
|
|
20
|
+
siret_code: z.string().nullable().openapi({
|
|
21
|
+
description: 'SIRET code',
|
|
22
|
+
example: '12345678901234'
|
|
23
|
+
}),
|
|
24
|
+
tva_intracom: z.string().nullable().openapi({
|
|
25
|
+
description: 'Intra-community VAT number',
|
|
26
|
+
example: 'FR12345678901'
|
|
27
|
+
}),
|
|
28
|
+
type: z.string().openapi({
|
|
29
|
+
description: 'Company type',
|
|
30
|
+
example: 'corporate'
|
|
31
|
+
}),
|
|
32
|
+
company_role: z.string().nullable().openapi({
|
|
33
|
+
description: 'Company role in the system',
|
|
34
|
+
example: 'exhibitor'
|
|
35
|
+
}),
|
|
36
|
+
company_street: z.string().nullable().openapi({
|
|
37
|
+
description: 'Company street address',
|
|
38
|
+
example: '123 Business Street'
|
|
39
|
+
}),
|
|
40
|
+
company_city: z.string().nullable().openapi({
|
|
41
|
+
description: 'Company city',
|
|
42
|
+
example: 'Paris'
|
|
43
|
+
}),
|
|
44
|
+
company_postal_code: z.string().nullable().openapi({
|
|
45
|
+
description: 'Company postal code',
|
|
46
|
+
example: '75001'
|
|
47
|
+
}),
|
|
48
|
+
company_country: z.string().nullable().openapi({
|
|
49
|
+
description: 'Company country',
|
|
50
|
+
example: 'France'
|
|
51
|
+
}),
|
|
52
|
+
company_address: z.string().nullable().openapi({
|
|
53
|
+
description: 'Full company address',
|
|
54
|
+
example: '123 Business Street, 75001 Paris, France'
|
|
55
|
+
}),
|
|
56
|
+
contact_first_name: z.string().nullable().openapi({
|
|
57
|
+
description: 'Contact person first name',
|
|
58
|
+
example: 'John'
|
|
59
|
+
}),
|
|
60
|
+
contact_last_name: z.string().nullable().openapi({
|
|
61
|
+
description: 'Contact person last name',
|
|
62
|
+
example: 'Doe'
|
|
63
|
+
}),
|
|
64
|
+
contact_email: z.string().email().nullable().openapi({
|
|
65
|
+
description: 'Contact email address',
|
|
66
|
+
example: 'john.doe@acme.com'
|
|
67
|
+
}),
|
|
68
|
+
contact_phone: z.string().nullable().openapi({
|
|
69
|
+
description: 'Contact phone number',
|
|
70
|
+
example: '+33123456789'
|
|
71
|
+
}),
|
|
72
|
+
is_active: z.boolean().openapi({
|
|
73
|
+
description: 'Whether the company is active',
|
|
74
|
+
example: true
|
|
75
|
+
}),
|
|
76
|
+
created_at: z.string().openapi({
|
|
77
|
+
description: 'Timestamp when company was created',
|
|
78
|
+
example: '2025-12-04T10:30:00.000Z'
|
|
79
|
+
}),
|
|
80
|
+
updated_at: z.string().openapi({
|
|
81
|
+
description: 'Timestamp when company was last updated',
|
|
82
|
+
example: '2025-12-04T10:30:00.000Z'
|
|
83
|
+
}),
|
|
84
|
+
created_by: z.string().uuid().nullable().openapi({
|
|
85
|
+
description: 'User who created the company',
|
|
86
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
87
|
+
}),
|
|
88
|
+
updated_by: z.string().uuid().nullable().openapi({
|
|
89
|
+
description: 'User who last updated the company',
|
|
90
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
91
|
+
}),
|
|
92
|
+
company_id: z.number().nullable().openapi({
|
|
93
|
+
description: 'Parent company ID if this is a subsidiary',
|
|
94
|
+
example: null
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
.openapi('FullCompany');
|
|
98
|
+
// ------------------------------
|
|
99
|
+
// Company roles response schemas
|
|
100
|
+
// ------------------------------
|
|
101
|
+
export const companyRoleSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
role: z.string().openapi({
|
|
104
|
+
description: 'Distinct company role',
|
|
105
|
+
example: 'exhibitor'
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
.openapi('CompanyRole');
|
|
109
|
+
export const companyRolesDataSchema = z
|
|
110
|
+
.object({
|
|
111
|
+
roles: z.array(companyRoleSchema).openapi({
|
|
112
|
+
description: 'List of distinct company roles',
|
|
113
|
+
example: [{ role: 'exhibitor' }, { role: 'sponsor' }, { role: 'visitor' }]
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
.openapi('CompanyRolesData');
|
|
117
|
+
// ------------------------------
|
|
118
|
+
// Response schemas
|
|
119
|
+
// ------------------------------
|
|
120
|
+
export const getCompanyRolesResponseSchema = createSuccessResponseSchema(companyRolesDataSchema, 'GetCompanyRolesResponse', 'List of distinct company roles with counts');
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './common.js';
|
|
2
|
+
export * from './pagination.js';
|
|
3
|
+
export * from './auth.js';
|
|
4
|
+
export * from './phaseBooking.js';
|
|
5
|
+
export * from './phaseSlot.js';
|
|
6
|
+
export * from './company.js';
|
|
7
|
+
export * from './enums/bookingStatus.js';
|
|
8
|
+
export * from './enums/slotStatus.js';
|
|
9
|
+
export { z } from './zod.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Main exports
|
|
2
|
+
export * from './common.js';
|
|
3
|
+
export * from './pagination.js';
|
|
4
|
+
export * from './auth.js';
|
|
5
|
+
export * from './phaseBooking.js';
|
|
6
|
+
export * from './phaseSlot.js';
|
|
7
|
+
export * from './company.js';
|
|
8
|
+
// Enum exports
|
|
9
|
+
export * from './enums/bookingStatus.js';
|
|
10
|
+
export * from './enums/slotStatus.js';
|
|
11
|
+
// Zod re-export for convenience
|
|
12
|
+
export { z } from './zod.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
export declare const paginationSchema: z.ZodObject<{
|
|
3
|
+
page: z.ZodOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
4
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
|
|
5
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
6
|
+
column: z.ZodString;
|
|
7
|
+
direction: z.ZodEnum<{
|
|
8
|
+
asc: "asc";
|
|
9
|
+
desc: "desc";
|
|
10
|
+
}>;
|
|
11
|
+
}, z.core.$strip>>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type PaginationDTO = z.infer<typeof paginationSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
export const paginationSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
page: z.coerce.number().int().nonnegative().default(1),
|
|
5
|
+
limit: z.coerce.number().int().nonnegative().default(10),
|
|
6
|
+
sort: z.array(z.object({
|
|
7
|
+
column: z.string(),
|
|
8
|
+
direction: z.enum(['asc', 'desc'])
|
|
9
|
+
}))
|
|
10
|
+
})
|
|
11
|
+
.partial();
|