feat(org): add organization and membership contract and storage

This commit is contained in:
shira committed 2026-10-06 15:55:29 +03:00
1 parent a0551a34b8
commit bdc5855001
90 files changed
+17545 -480

No files matched your search

@@ -6,4 +6,5 @@ export { getHealthMock } from './health/health.msw'
export { getIdentityMock } from './identity/identity.msw'
export { getInvitationMock } from './invitation/invitation.msw'
export { getNeedMock } from './need/need.msw'
export { getOrganizationMock } from './organization/organization.msw'
export { getSupportMock } from './support/support.msw'
@@ -6,4 +6,5 @@ export * from './health/health';
export * from './identity/identity';
export * from './invitation/invitation';
export * from './need/need';
export * from './organization/organization';
export * from './support/support';
@@ -0,0 +1,90 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
faker
} from '@faker-js/faker';
import {
fakeFromPattern
} from '../../mock-pattern';
import {
HttpResponse,
http
} from 'msw';
import type {
RequestHandlerOptions
} from 'msw';
import type {
MyOrganizationList,
Organization
} from '../../schemas';
export const getListMyOrganizationsResponseMock = (overrideResponse: Partial<Extract<MyOrganizationList, object>> = {}): MyOrganizationList => ({items: Array.from({ length: faker.number.int({min: 1, max: 100}) }, (_, i) => i + 1).map(() => ({organization: {id: faker.string.uuid(), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), verification_level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const)}, membership: {organization_id: faker.string.uuid(), role: faker.helpers.arrayElement(['owner','recruiter','hiring_manager','technical_expert'] as const), state: faker.helpers.arrayElement(['active','suspended','removed','left'] as const), joined_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}})), page: {has_more: faker.datatype.boolean(), next_cursor: faker.helpers.arrayElement([fakeFromPattern("^[A-Za-z0-9_-]+$", {minLength: 1, maxLength: 512}), null])}, ...overrideResponse})
export const getCreateOrganizationResponseMock = (overrideResponse: Partial<Extract<Organization, object>> = {}): Organization => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), verification: {level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const), basis: faker.helpers.arrayElement(['confirmed_email','corporate_domain','requisites_and_authority','manual_review','partner_status'] as const), changed_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, candidate_card: {id: faker.string.uuid(), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: faker.helpers.arrayElement([Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), null]), verification_level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const)}, created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getGetOrganizationResponseMock = (overrideResponse: Partial<Extract<Organization, object>> = {}): Organization => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), verification: {level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const), basis: faker.helpers.arrayElement(['confirmed_email','corporate_domain','requisites_and_authority','manual_review','partner_status'] as const), changed_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, candidate_card: {id: faker.string.uuid(), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: faker.helpers.arrayElement([Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), null]), verification_level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const)}, created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getUpdateOrganizationResponseMock = (overrideResponse: Partial<Extract<Organization, object>> = {}): Organization => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), verification: {level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const), basis: faker.helpers.arrayElement(['confirmed_email','corporate_domain','requisites_and_authority','manual_review','partner_status'] as const), changed_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, candidate_card: {id: faker.string.uuid(), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: faker.helpers.arrayElement([Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), null]), verification_level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const)}, created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getListMyOrganizationsMockHandler = (overrideResponse?: MyOrganizationList | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<MyOrganizationList> | MyOrganizationList), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/me/organizations', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getListMyOrganizationsResponseMock(),
{ status: 200
})
}, options)
}
export const getCreateOrganizationMockHandler = (overrideResponse?: Organization | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<Organization> | Organization), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/organizations', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getCreateOrganizationResponseMock(),
{ status: 201
})
}, options)
}
export const getGetOrganizationMockHandler = (overrideResponse?: Organization | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<Organization> | Organization), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/organizations/:orgId', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetOrganizationResponseMock(),
{ status: 200
})
}, options)
}
export const getUpdateOrganizationMockHandler = (overrideResponse?: Organization | ((info: Parameters<Parameters<typeof http.patch>[1]>[0]) => Promise<Organization> | Organization), options?: RequestHandlerOptions) => {
return http.patch('*/api/v1/organizations/:orgId', async (info: Parameters<Parameters<typeof http.patch>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getUpdateOrganizationResponseMock(),
{ status: 200
})
}, options)
}
export const getOrganizationMock = () => [
getListMyOrganizationsMockHandler(),
getCreateOrganizationMockHandler(),
getGetOrganizationMockHandler(),
getUpdateOrganizationMockHandler()
]
@@ -0,0 +1,471 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
useMutation,
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
CreateOrganizationHeaders,
ListMyOrganizationsParams,
MyOrganizationList,
Organization,
OrganizationCreate,
OrganizationUpdate,
Problem
} from '../../schemas';
import { apiRequest } from '../../client';
import type { ErrorType } from '../../client';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
const withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {
const result = { queryKey } as T & { queryKey: K };
for (const key of Object.keys(query)) {
// The explicit queryKey always wins, matching the previous
// `{ ...query, queryKey }` spread where it was set last.
if (key === 'queryKey') continue;
Object.defineProperty(result, key, {
enumerable: true,
configurable: true,
get: () => (query as Record<string, unknown>)[key],
});
}
return result;
};
export const getListMyOrganizationsUrl = (params?: ListMyOrganizationsParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/api/v1/me/organizations?${stringifiedParams}` : `/api/v1/me/organizations`
}
/**
* Requires the session cookie of an employer account. The account comes from the session, never from a request parameter, so the response holds only the caller's own memberships and no request can name another account.
*
* Returns a page of the organizations in which the caller has an `active` membership, newest membership first with the organization identifier as the tie-breaker, with cursor pagination. Each item names the organization (`OrganizationSummary`) and holds the caller's role and state in it (`OrganizationMembership`). A membership in another state (`suspended`, `removed`, `left`) does not list its organization, so an organization the caller cannot enter is never named, and one that the caller was removed from disappears from the list at once.
*
* The list is the directory of the active organization context. The context is not stored on the server: every organization-scoped operation names its organization in the path `org_id`, and the server checks that identifier against the caller's active membership on every request, so a switch between organizations is a different `org_id` in the client's routes and cannot outlive a revoked membership. A client picks the context from this list, may remember the last choice in the browser as a convenience, and must read the list again after any answer 404 `not_found` from an organization path. An account with several memberships sees all of them here and works in one at a time; the rights and the data of the organizations stay separate.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden. An employer account without an organization gets an empty page, which tells the client to offer CreateOrganization. A malformed `limit` or `cursor` answers 400 validation_failed.
* @summary List the organizations available to the current account.
*/
export const listMyOrganizations = async (params?: ListMyOrganizationsParams, options?: Parameters<typeof apiRequest>[1]): Promise<MyOrganizationList> => {
return apiRequest<MyOrganizationList>(getListMyOrganizationsUrl(params),
{
...options,
method: 'GET'
}
);}
export const getListMyOrganizationsQueryKey = (params?: ListMyOrganizationsParams,) => {
return [
`/api/v1/me/organizations`, ...(params ? [params] : [])
] as const;
}
export const getListMyOrganizationsQueryOptions = <TData = Awaited<ReturnType<typeof listMyOrganizations>>, TError = ErrorType<Problem>>(params?: ListMyOrganizationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyOrganizations>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getListMyOrganizationsQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof listMyOrganizations>>> = ({ signal }) => listMyOrganizations(params, { signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMyOrganizations>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type ListMyOrganizationsQueryResult = NonNullable<Awaited<ReturnType<typeof listMyOrganizations>>>
export type ListMyOrganizationsQueryError = ErrorType<Problem>
export function useListMyOrganizations<TData = Awaited<ReturnType<typeof listMyOrganizations>>, TError = ErrorType<Problem>>(
params: undefined | ListMyOrganizationsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyOrganizations>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof listMyOrganizations>>,
TError,
Awaited<ReturnType<typeof listMyOrganizations>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListMyOrganizations<TData = Awaited<ReturnType<typeof listMyOrganizations>>, TError = ErrorType<Problem>>(
params?: ListMyOrganizationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyOrganizations>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof listMyOrganizations>>,
TError,
Awaited<ReturnType<typeof listMyOrganizations>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListMyOrganizations<TData = Awaited<ReturnType<typeof listMyOrganizations>>, TError = ErrorType<Problem>>(
params?: ListMyOrganizationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyOrganizations>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary List the organizations available to the current account.
*/
export function useListMyOrganizations<TData = Awaited<ReturnType<typeof listMyOrganizations>>, TError = ErrorType<Problem>>(
params?: ListMyOrganizationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyOrganizations>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getListMyOrganizationsQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getCreateOrganizationUrl = () => {
return `/api/v1/organizations`
}
/**
* Requires the session cookie of an employer account with a confirmed email, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The owner is the account of the session: the body has no owner, membership, role, verification, or version field, and unknown fields fail validation.
*
* The server creates the organization and the owner membership of the caller (role `owner`, state `active`) in one transaction, so an organization never exists without its owner. The organization starts at the verification level `e0` with the basis `confirmed_email`. The level cannot be requested: the creator of a company with a corporate domain, a long description, or many representatives still gets `e0`, and `e1`, `e2`, and `e3` come only from verification processes of the server that do not exist yet. Only `name` is required; the rest of the card can be completed with UpdateOrganization.
*
* Idempotency: a retry with the same key and body within 24 hours replays the stored 201 and creates nothing, so a lost response never creates a second organization. A different body with the same key answers 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again. Two requests with different keys are two organizations; the product may limit the number of organizations per account (open question), which would answer 409 `state_conflict` without a change of the schema.
*
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate account), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a pointer such as `/contacts/website` for a website that is not an https URL of a host name, `/name` for a name with surrounding whitespace). The general rate limit can answer 429 with Retry-After before any check; 429 is never stored.
* @summary Create an organization; the caller becomes its owner.
*/
export const createOrganization = async (organizationCreate: OrganizationCreate,
headers: CreateOrganizationHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<Organization> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<Organization>(getCreateOrganizationUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
body: JSON.stringify(organizationCreate)
}
);}
export const getCreateOrganizationMutationKey = () => ['createOrganization'] as const;
export const getCreateOrganizationMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganization>>, TError,CreateOrganizationMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof createOrganization>>, TError,CreateOrganizationMutationVariables, TContext> => {
const mutationKey = getCreateOrganizationMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganization>>, CreateOrganizationMutationVariables> = (props) => {
const {data,headers} = props ?? {};
return createOrganization(data,headers,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type CreateOrganizationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganization>>>
export type CreateOrganizationMutationBody = OrganizationCreate
export type CreateOrganizationMutationError = ErrorType<Problem>
export type CreateOrganizationMutationVariables = {data: OrganizationCreate;headers: CreateOrganizationHeaders}
/**
* @summary Create an organization; the caller becomes its owner.
*/
export const useCreateOrganization = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganization>>, TError,CreateOrganizationMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof createOrganization>>,
TError,
CreateOrganizationMutationVariables,
TContext
> => {
return useMutation(getCreateOrganizationMutationOptions(options), queryClient);
}
export const getGetOrganizationUrl = (orgId: string,) => {
return `/api/v1/organizations/${orgId}`
}
/**
* Requires the session cookie of an employer account with an active membership in `org_id`. The organization comes from the path and is checked against the membership that the server holds for the session account on every request; the identifier itself grants nothing.
*
* Returns the profile with its current `version`, the verification level (`verification`), and the card as a candidate sees it (`candidate_card`). The verification level is always the one the server holds: it never rises because the profile is complete, because the organization has members, or because of an email domain. The role of the caller is not part of this resource; ListMyOrganizations returns it with the membership.
*
* In the MVP the profile is readable by any active member; every member is an owner, because the operations that add members are planned. The roles of PRD FR07 that read a company card without managing it change no field of this contract.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an account without an active membership in the organization, including a `suspended`, `removed`, or `left` one, and an unknown organization all answer 404 not_found, so organizations cannot be enumerated. A malformed `org_id` answers 400 validation_failed with the path pointer.
* @summary Read an organization of which the caller is a member.
*/
export const getOrganization = async (orgId: string, options?: Parameters<typeof apiRequest>[1]): Promise<Organization> => {
return apiRequest<Organization>(getGetOrganizationUrl(orgId),
{
...options,
method: 'GET'
}
);}
export const getGetOrganizationQueryKey = (orgId: string,) => {
return [
`/api/v1/organizations/${orgId}`
] as const;
}
export const getGetOrganizationQueryOptions = <TData = Awaited<ReturnType<typeof getOrganization>>, TError = ErrorType<Problem>>(orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganization>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetOrganizationQueryKey(orgId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganization>>> = ({ signal }) => getOrganization(orgId, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: orgId !== null && orgId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganization>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetOrganizationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganization>>>
export type GetOrganizationQueryError = ErrorType<Problem>
export function useGetOrganization<TData = Awaited<ReturnType<typeof getOrganization>>, TError = ErrorType<Problem>>(
orgId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganization>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getOrganization>>,
TError,
Awaited<ReturnType<typeof getOrganization>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetOrganization<TData = Awaited<ReturnType<typeof getOrganization>>, TError = ErrorType<Problem>>(
orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganization>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getOrganization>>,
TError,
Awaited<ReturnType<typeof getOrganization>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetOrganization<TData = Awaited<ReturnType<typeof getOrganization>>, TError = ErrorType<Problem>>(
orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganization>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read an organization of which the caller is a member.
*/
export function useGetOrganization<TData = Awaited<ReturnType<typeof getOrganization>>, TError = ErrorType<Problem>>(
orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganization>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetOrganizationQueryOptions(orgId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getUpdateOrganizationUrl = (orgId: string,) => {
return `/api/v1/organizations/${orgId}`
}
/**
* Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. Only the owner manages the organization (the FR07 matrix gives this to no other role), so a member with another role answers 403 forbidden. The role comes from the server-side membership; the body has no organization, membership, role, owner, or verification field.
*
* Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch. Each field present replaces that field as a whole and an absent field stays unchanged; `contacts` and `representatives` are replaced entirely and never merged. `description` and `sphere` sent as null become unset; `name`, `contacts`, and `representatives` cannot be null.
*
* The body can change the profile only. The verification level, its basis, the card, the members, and every role are not fields of it, and unknown fields fail validation, so the owner can neither raise the trust level of the organization nor the rights of anyone by editing the profile; a longer description, a verified-looking website, or a new representative leaves the level unchanged. The level and the roles change only through processes of the server.
*
* Versions: every committed change creates version `expected_version + 1` and answers 200 with the organization. `expected_version` is the `version` the client read; when it is not current, the server answers 412 version_conflict and changes nothing, and the client reads the organization again and reapplies its edits. The version travels in the body rather than in If-Match because the generated client cannot read the ETag response header yet, as for needs. A body that changes nothing when applied to the current profile keeps the version and answers 200 with the current organization even when `expected_version` is older, so the operation needs no Idempotency-Key and a retry of a change that already succeeded is harmless.
*
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate account), membership (404 not_found) and role (403 forbidden), a body that changes nothing (200), the version (412), domain rules (400 with a pointer such as `/contacts/website`, `/name`, or `/representatives/0/job_title`). The general rate limit can answer 429 with Retry-After before any check.
* @summary Change the profile of an organization.
*/
export const updateOrganization = async (orgId: string,
organizationUpdate: OrganizationUpdate, options?: Parameters<typeof apiRequest>[1]): Promise<Organization> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<Organization>(getUpdateOrganizationUrl(orgId),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
body: JSON.stringify(organizationUpdate)
}
);}
export const getUpdateOrganizationMutationKey = () => ['updateOrganization'] as const;
export const getUpdateOrganizationMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateOrganization>>, TError,UpdateOrganizationMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof updateOrganization>>, TError,UpdateOrganizationMutationVariables, TContext> => {
const mutationKey = getUpdateOrganizationMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateOrganization>>, UpdateOrganizationMutationVariables> = (props) => {
const {orgId,data} = props ?? {};
return updateOrganization(orgId,data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type UpdateOrganizationMutationResult = NonNullable<Awaited<ReturnType<typeof updateOrganization>>>
export type UpdateOrganizationMutationBody = OrganizationUpdate
export type UpdateOrganizationMutationError = ErrorType<Problem>
export type UpdateOrganizationMutationVariables = {orgId: string;data: OrganizationUpdate}
/**
* @summary Change the profile of an organization.
*/
export const useUpdateOrganization = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateOrganization>>, TError,UpdateOrganizationMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof updateOrganization>>,
TError,
UpdateOrganizationMutationVariables,
TContext
> => {
return useMutation(getUpdateOrganizationMutationOptions(options), queryClient);
}
@@ -0,0 +1,369 @@
import { describe, expect, expectTypeOf, it } from "vitest";
import { createOrganization, updateOrganization } from "./endpoints/organization/organization";
import {
CreateOrganizationBody,
ListMyOrganizationsParams,
MyOrganizationList,
Organization,
OrganizationCreate,
OrganizationMembership,
CandidateOrganizationCard,
OrganizationRole,
OrganizationUpdate,
OrganizationVerificationLevel,
UpdateOrganizationBody,
} from "./schemas";
// These tests pin the generated organization contract that the employer
// cabinet (TASK-080) and the organization switcher consume. They fail when
// regeneration drops a limit of the profile, loses a level, role, or state of
// the PRD, lets a request carry a role or a verification level, or lets a
// response name a member or an account.
const contacts = {
website: "https://payments.example.com",
email: "careers@payments.example.com",
phone: "+74950000000",
telegram: "@payments_careers",
} as const;
const noContacts = { website: null, email: null, phone: null, telegram: null } as const;
const representative = { name: "Анна Тестова", job_title: "Руководитель по подбору" } as const;
const organizationId = "01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01";
const card = {
id: organizationId,
name: "ООО Пример Платежи",
description: "Платежный сервис для малого бизнеса.",
sphere: "Платежи и финансовые сервисы",
contacts,
representatives: [representative],
verification_level: "e0",
} as const;
const organization = {
id: organizationId,
version: 2,
name: card.name,
description: card.description,
sphere: card.sphere,
contacts,
representatives: [representative],
verification: { level: "e0", basis: "confirmed_email", changed_at: "2026-10-06T09:00:00Z" },
candidate_card: card,
created_at: "2026-10-06T09:00:00Z",
updated_at: "2026-10-06T09:40:00Z",
} as const;
const createSchemas = [
["OrganizationCreate", OrganizationCreate],
["CreateOrganizationBody", CreateOrganizationBody],
] as const;
describe.each(createSchemas)("generated %s", (_name, schema) => {
it("accepts a name only and a complete card", () => {
expect(schema.parse({ name: "ООО Пример" })).toEqual({ name: "ООО Пример" });
const complete = {
name: card.name,
description: card.description,
sphere: card.sphere,
contacts,
representatives: [representative],
};
expect(schema.parse(complete)).toEqual(complete);
});
it("requires the name", () => {
expect(schema.safeParse({ sphere: "Платежи" }).success).toBe(false);
});
it.each([
["an empty name", { name: "" }],
["a name over 200 characters", { name: "я".repeat(201) }],
["a name with a leading space", { name: " ООО" }],
["a name with a line break", { name: "ООО\nПример" }],
["an empty description", { name: "ООО", description: "" }],
["a description over 2000 characters", { name: "ООО", description: "я".repeat(2001) }],
["a sphere with a trailing space", { name: "ООО", sphere: "Платежи " }],
["a sphere over 100 characters", { name: "ООО", sphere: "я".repeat(101) }],
[
"an http website",
{ name: "ООО", contacts: { ...noContacts, website: "http://a.example.com" } },
],
[
"a website with credentials",
{ name: "ООО", contacts: { ...noContacts, website: "https://user@a.example.com" } },
],
["a phone outside E.164", { name: "ООО", contacts: { ...noContacts, phone: "8 495 000" } }],
[
"a Telegram username without @",
{ name: "ООО", contacts: { ...noContacts, telegram: "careers" } },
],
[
"an email that is not an address",
{ name: "ООО", contacts: { ...noContacts, email: "careers" } },
],
[
"contacts that omit a field",
{ name: "ООО", contacts: { website: null, email: null, phone: null } },
],
[
"eleven representatives",
{ name: "ООО", representatives: Array.from({ length: 11 }, () => representative) },
],
[
"a representative without a job title",
{ name: "ООО", representatives: [{ name: "Анна Тестова" }] },
],
])("rejects %s", (_case, body) => {
expect(schema.safeParse(body).success).toBe(false);
});
it("drops a role or a verification level that a client would add", () => {
// Generated Zod strips unknown keys and the server rejects them with 400,
// so a value sent this way never reaches the profile.
const parsed = schema.parse({
name: "ООО Пример",
role: "owner",
verification_level: "e3",
owner_id: "01928f7a-0000-7000-8000-00000000c0de",
});
expect(parsed).toEqual({ name: "ООО Пример" });
});
});
const updateSchemas = [
["OrganizationUpdate", OrganizationUpdate],
["UpdateOrganizationBody", UpdateOrganizationBody],
] as const;
describe.each(updateSchemas)("generated %s", (_name, schema) => {
it("requires the version that the client read", () => {
expect(schema.safeParse({ name: "ООО Новое" }).success).toBe(false);
expect(schema.safeParse({ expected_version: 0, name: "ООО Новое" }).success).toBe(false);
expect(schema.parse({ expected_version: 1 })).toEqual({ expected_version: 1 });
});
it("replaces the profile fields as a whole and clears the optional ones with null", () => {
const body = {
expected_version: 3,
name: "ООО Новое",
description: null,
sphere: null,
contacts: noContacts,
representatives: [],
};
expect(schema.parse(body)).toEqual(body);
});
it.each([
["a null name", { name: null }],
["null contacts", { contacts: null }],
["null representatives", { representatives: null }],
["partial contacts", { contacts: { website: null, email: null } }],
["a name with a line break", { name: "ООО\nНовое" }],
])("rejects %s", (_case, change) => {
expect(schema.safeParse({ expected_version: 1, ...change }).success).toBe(false);
});
it("drops a role or a verification level that a client would add", () => {
const parsed = schema.parse({
expected_version: 1,
name: "ООО Новое",
role: "owner",
verification: { level: "e3", basis: "manual_review", changed_at: "2026-10-06T09:00:00Z" },
verification_level: "e2",
});
expect(parsed).toEqual({ expected_version: 1, name: "ООО Новое" });
});
});
describe("generated Organization", () => {
it("accepts a member's view with the level e0 and the candidate card", () => {
expect(Organization.parse(organization)).toEqual(organization);
});
it("accepts an organization without a description, a sphere, or contacts", () => {
const bare = {
...organization,
description: null,
sphere: null,
contacts: noContacts,
representatives: [],
candidate_card: {
...card,
description: null,
sphere: null,
contacts: noContacts,
representatives: [],
},
};
expect(Organization.parse(bare)).toEqual(bare);
});
it.each([
["an unknown level", { verification: { ...organization.verification, level: "e4" } }],
["an unknown basis", { verification: { ...organization.verification, basis: "domain" } }],
["a version below 1", { version: 0 }],
["a missing card", { candidate_card: undefined }],
])("rejects %s", (_case, change) => {
expect(Organization.safeParse({ ...organization, ...change }).success).toBe(false);
});
it("accepts a candidate card whose representatives are not published", () => {
const withoutList: Record<string, unknown> = { ...card };
delete withoutList["representatives"];
expect(CandidateOrganizationCard.parse(withoutList)).toEqual(withoutList);
expect(
CandidateOrganizationCard.parse({ ...card, representatives: null }).representatives,
).toBeNull();
expect(
CandidateOrganizationCard.safeParse({ ...card, representatives: undefined }).success,
).toBe(true);
expect(CandidateOrganizationCard.safeParse({ ...card, contacts: undefined }).success).toBe(
false,
);
});
it("knows the four levels of the PRD and no others", () => {
expect(OrganizationVerificationLevel.options).toEqual(["e0", "e1", "e2", "e3"]);
});
});
describe("generated roles and memberships", () => {
it("lists the four roles of the FR07 matrix", () => {
expect(OrganizationRole.options).toEqual([
"owner",
"recruiter",
"hiring_manager",
"technical_expert",
]);
});
it.each([
["an unknown role", { role: "admin" }],
["an unknown state", { state: "invited" }],
])("rejects a membership with %s", (_case, change) => {
const membership = {
organization_id: organizationId,
role: "owner",
state: "active",
joined_at: "2026-10-06T09:00:00Z",
...change,
};
expect(OrganizationMembership.safeParse(membership).success).toBe(false);
});
});
describe("generated MyOrganizationList", () => {
const page = {
items: [
{
organization: { id: organizationId, name: card.name, verification_level: "e0" },
membership: {
organization_id: organizationId,
role: "owner",
state: "active",
joined_at: "2026-10-06T09:00:00Z",
},
},
],
page: { has_more: false, next_cursor: null },
} as const;
it("accepts the organizations of the caller with the caller's membership", () => {
expect(MyOrganizationList.parse(page)).toEqual(page);
});
it("accepts the page parameters and nothing that names another account", () => {
expect(ListMyOrganizationsParams.parse({ limit: 50 })).toEqual({ limit: 50 });
expect(ListMyOrganizationsParams.parse({})).toEqual({ limit: 20 });
expect(ListMyOrganizationsParams.safeParse({ limit: 101 }).success).toBe(false);
expect(
ListMyOrganizationsParams.parse({ user_id: "01928f7a-0000-7000-8000-00000000c0de" }),
).toEqual({
limit: 20,
});
});
});
type RaisingRequestKey =
| "role"
| "roles"
| "verification"
| "verification_level"
| "verification_basis"
| "level"
| "basis"
| "trust_level"
| "owner"
| "owner_id"
| "members"
| "membership"
| "user_id"
| "account_id"
| "permissions"
| "candidate_card"
| "id"
| "version"
| "created_at"
| "updated_at";
type PrivateCardKey =
| "role"
| "membership"
| "members"
| "verification"
| "basis"
| "version"
| "created_at"
| "updated_at"
| "user_id"
| "account_id";
it("exposes request DTOs without a role, an owner, a verification level, or a member", () => {
expectTypeOf<Extract<keyof OrganizationCreate, RaisingRequestKey>>().toEqualTypeOf<never>();
expectTypeOf<Extract<keyof OrganizationUpdate, RaisingRequestKey>>().toEqualTypeOf<never>();
expectTypeOf<keyof OrganizationCreate>().toEqualTypeOf<
"name" | "description" | "sphere" | "contacts" | "representatives"
>();
expectTypeOf<keyof OrganizationUpdate>().toEqualTypeOf<
"expected_version" | "name" | "description" | "sphere" | "contacts" | "representatives"
>();
expectTypeOf<
Extract<keyof NonNullable<OrganizationUpdate["contacts"]>, RaisingRequestKey>
>().toEqualTypeOf<never>();
// A representative is presentation only: a name and a job title, no
// account, no role, and no contact.
expectTypeOf<keyof NonNullable<OrganizationUpdate["representatives"]>[number]>().toEqualTypeOf<
"name" | "job_title"
>();
expectTypeOf(createOrganization).parameter(0).toEqualTypeOf<OrganizationCreate>();
expectTypeOf(updateOrganization).parameter(1).toEqualTypeOf<OrganizationUpdate>();
});
it("keeps the role in the membership and off the organization and its card", () => {
expectTypeOf<
Extract<keyof Organization, "role" | "members" | "membership" | "owner_id">
>().toEqualTypeOf<never>();
expectTypeOf<Extract<keyof CandidateOrganizationCard, PrivateCardKey>>().toEqualTypeOf<never>();
expectTypeOf<
Extract<keyof OrganizationMembership, "user_id" | "account_id" | "email">
>().toEqualTypeOf<never>();
expectTypeOf<OrganizationMembership["role"]>().toEqualTypeOf<
"owner" | "recruiter" | "hiring_manager" | "technical_expert"
>();
expectTypeOf<OrganizationMembership["state"]>().toEqualTypeOf<
"active" | "suspended" | "removed" | "left"
>();
expectTypeOf<Organization["verification"]["level"]>().toEqualTypeOf<"e0" | "e1" | "e2" | "e3">();
expectTypeOf<keyof ListMyOrganizationsParams>().toEqualTypeOf<"limit" | "cursor">();
});
+3
View File
@@ -7,6 +7,8 @@
export * from './consentTextVersion.zod';
export * from './contactFieldKind.zod';
export * from './contactPhoneNumber.zod';
export * from './contactTelegramUsername.zod';
export * from './currencyCode.zod';
export * from './emailAddress.zod';
export * from './gradeCode.zod';
@@ -36,4 +38,5 @@ export * from './health';
export * from './identity';
export * from './invitation';
export * from './need';
export * from './organization';
export * from './support';
@@ -89,7 +89,7 @@ export const CandidateInvitation = zod.object({
"organization": zod.object({
"id": zod.uuid().describe('Identifier of the organization.'),
"name": zod.string().min(1).max(candidateInvitationOrganizationNameMax).describe('Public name of the organization. Plain text; clients show it as text, never as HTML.')
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The organization contract (TASK-077) adds the public card; this object only names it.'),
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The card that a candidate sees is `CandidateOrganizationCard` of the organization contract; returning it with the invitation is planned as an additive field, and this object only names the organization.'),
"state": zod.enum(['draft', 'delivered', 'viewed', 'counter', 'accepted', 'interview_scheduled', 'interviewed', 'negotiation', 'terms_agreed', 'no_deal', 'declined', 'expired', 'withdrawn', 'cancelled_by_candidate']).describe('State of an invitation (PRD FR12). The internal sending step is never visible: a successful send already answers with `delivered`.\n\n- draft: the organization prepares the terms. The candidate does not see the invitation.\n- delivered: the invitation is in the candidate\'s inbox and the response deadline runs.\n- viewed: the candidate opened the terms; ViewMyInvitation records it. The deadline is unchanged.\n- counter: planned; the candidate sent the one counter offer. No MVP operation produces it.\n- accepted: the candidate accepted the current terms version and gave the consent C4; the contact grant exists.\n- interview_scheduled, interviewed, negotiation, terms_agreed, no_deal: planned stages after an acceptance (interview and the sealed final of FR13). No MVP operation produces them.\n- declined: terminal; the candidate declined with a structured reason. No access arises.\n- expired: terminal; a server deadline passed, see `expiry_reason`. No access arises.\n- withdrawn: terminal; the organization withdrew the invitation. A grant that already exists is not revoked by it.\n- cancelled_by_candidate: terminal; the candidate cancelled the participation. The grant of this invitation is revoked.\n\nPlanned states are listed now so that generated clients accept them when their operations arrive. Adding another value is a contract change.'),
"expiry_reason": zod.union([zod.enum(['invitation_timeout', 'negotiation_timeout']).describe('Why an invitation expired. Set exactly when the state is `expired`, null otherwise.\n\n- invitation_timeout: the candidate did not answer by `response_deadline_at`. No grant is created.\n- negotiation_timeout: planned; the sealed final of FR13 closed without both bids. No MVP operation produces it.'),zod.null()]),
"version": zod.int().min(1).describe('Version of an invitation. Creation makes version 1, and every committed change advances it by exactly one: a change of the draft, a send, the first view, an answer, a salary raise, a withdrawal, a cancellation, and an expiry made by the server. Every command carries the version the client read as `expected_version`; a stale value answers 412 version_conflict and changes nothing.'),
@@ -37,7 +37,7 @@ export const CandidateInvitationList = zod.object({
"organization": zod.object({
"id": zod.uuid().describe('Identifier of the organization.'),
"name": zod.string().min(1).max(candidateInvitationListItemsItemOrganizationNameMax).describe('Public name of the organization. Plain text; clients show it as text, never as HTML.')
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The organization contract (TASK-077) adds the public card; this object only names it.'),
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The card that a candidate sees is `CandidateOrganizationCard` of the organization contract; returning it with the invitation is planned as an additive field, and this object only names the organization.'),
"state": zod.enum(['draft', 'delivered', 'viewed', 'counter', 'accepted', 'interview_scheduled', 'interviewed', 'negotiation', 'terms_agreed', 'no_deal', 'declined', 'expired', 'withdrawn', 'cancelled_by_candidate']).describe('State of an invitation (PRD FR12). The internal sending step is never visible: a successful send already answers with `delivered`.\n\n- draft: the organization prepares the terms. The candidate does not see the invitation.\n- delivered: the invitation is in the candidate\'s inbox and the response deadline runs.\n- viewed: the candidate opened the terms; ViewMyInvitation records it. The deadline is unchanged.\n- counter: planned; the candidate sent the one counter offer. No MVP operation produces it.\n- accepted: the candidate accepted the current terms version and gave the consent C4; the contact grant exists.\n- interview_scheduled, interviewed, negotiation, terms_agreed, no_deal: planned stages after an acceptance (interview and the sealed final of FR13). No MVP operation produces them.\n- declined: terminal; the candidate declined with a structured reason. No access arises.\n- expired: terminal; a server deadline passed, see `expiry_reason`. No access arises.\n- withdrawn: terminal; the organization withdrew the invitation. A grant that already exists is not revoked by it.\n- cancelled_by_candidate: terminal; the candidate cancelled the participation. The grant of this invitation is revoked.\n\nPlanned states are listed now so that generated clients accept them when their operations arrive. Adding another value is a contract change.'),
"expiry_reason": zod.union([zod.enum(['invitation_timeout', 'negotiation_timeout']).describe('Why an invitation expired. Set exactly when the state is `expired`, null otherwise.\n\n- invitation_timeout: the candidate did not answer by `response_deadline_at`. No grant is created.\n- negotiation_timeout: planned; the sealed final of FR13 closed without both bids. No MVP operation produces it.'),zod.null()]),
"version": zod.int().min(1).describe('Version of an invitation. Creation makes version 1, and every committed change advances it by exactly one: a change of the draft, a send, the first view, an answer, a salary raise, a withdrawal, a cancellation, and an expiry made by the server. Every command carries the version the client read as `expected_version`; a stale value answers 412 version_conflict and changes nothing.'),
@@ -30,7 +30,7 @@ export const CandidateInvitationSummary = zod.object({
"organization": zod.object({
"id": zod.uuid().describe('Identifier of the organization.'),
"name": zod.string().min(1).max(candidateInvitationSummaryOrganizationNameMax).describe('Public name of the organization. Plain text; clients show it as text, never as HTML.')
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The organization contract (TASK-077) adds the public card; this object only names it.'),
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The card that a candidate sees is `CandidateOrganizationCard` of the organization contract; returning it with the invitation is planned as an additive field, and this object only names the organization.'),
"state": zod.enum(['draft', 'delivered', 'viewed', 'counter', 'accepted', 'interview_scheduled', 'interviewed', 'negotiation', 'terms_agreed', 'no_deal', 'declined', 'expired', 'withdrawn', 'cancelled_by_candidate']).describe('State of an invitation (PRD FR12). The internal sending step is never visible: a successful send already answers with `delivered`.\n\n- draft: the organization prepares the terms. The candidate does not see the invitation.\n- delivered: the invitation is in the candidate\'s inbox and the response deadline runs.\n- viewed: the candidate opened the terms; ViewMyInvitation records it. The deadline is unchanged.\n- counter: planned; the candidate sent the one counter offer. No MVP operation produces it.\n- accepted: the candidate accepted the current terms version and gave the consent C4; the contact grant exists.\n- interview_scheduled, interviewed, negotiation, terms_agreed, no_deal: planned stages after an acceptance (interview and the sealed final of FR13). No MVP operation produces them.\n- declined: terminal; the candidate declined with a structured reason. No access arises.\n- expired: terminal; a server deadline passed, see `expiry_reason`. No access arises.\n- withdrawn: terminal; the organization withdrew the invitation. A grant that already exists is not revoked by it.\n- cancelled_by_candidate: terminal; the candidate cancelled the participation. The grant of this invitation is revoked.\n\nPlanned states are listed now so that generated clients accept them when their operations arrive. Adding another value is a contract change.'),
"expiry_reason": zod.union([zod.enum(['invitation_timeout', 'negotiation_timeout']).describe('Why an invitation expired. Set exactly when the state is `expired`, null otherwise.\n\n- invitation_timeout: the candidate did not answer by `response_deadline_at`. No grant is created.\n- negotiation_timeout: planned; the sealed final of FR13 closed without both bids. No MVP operation produces it.'),zod.null()]),
"version": zod.int().min(1).describe('Version of an invitation. Creation makes version 1, and every committed change advances it by exactly one: a change of the draft, a send, the first view, an answer, a salary raise, a withdrawal, a cancellation, and an expiry made by the server. Every command carries the version the client read as `expected_version`; a stale value answers 412 version_conflict and changes nothing.'),
@@ -21,9 +21,7 @@ export * from './contactDisclosure.zod';
export * from './contactFullName.zod';
export * from './contactGrant.zod';
export * from './contactGrantState.zod';
export * from './contactPhoneNumber.zod';
export * from './contactRevocationReason.zod';
export * from './contactTelegramUsername.zod';
export * from './createOrganizationInvitationBody.zod';
export * from './createOrganizationInvitationHeaders.zod';
export * from './declineMyInvitationBody.zod';
@@ -12,7 +12,7 @@ export const invitationOrganizationNameMax = 200;
export const InvitationOrganization = zod.object({
"id": zod.uuid().describe('Identifier of the organization.'),
"name": zod.string().min(1).max(invitationOrganizationNameMax).describe('Public name of the organization. Plain text; clients show it as text, never as HTML.')
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The organization contract (TASK-077) adds the public card; this object only names it.')
}).describe('Organization that sent the invitation, as the candidate sees it before deciding. The card that a candidate sees is `CandidateOrganizationCard` of the organization contract; returning it with the invitation is planned as an additive field, and this object only names the organization.')
export type InvitationOrganization = zod.input<typeof InvitationOrganization>;
export type InvitationOrganizationOutput = zod.output<typeof InvitationOrganization>;
@@ -0,0 +1,67 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const candidateOrganizationCardNameMax = 200;
export const candidateOrganizationCardNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const candidateOrganizationCardDescriptionOneMax = 2000;
export const candidateOrganizationCardSphereOneMax = 100;
export const candidateOrganizationCardSphereOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const candidateOrganizationCardContactsWebsiteOneMin = 9;
export const candidateOrganizationCardContactsWebsiteOneMax = 300;
export const candidateOrganizationCardContactsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const candidateOrganizationCardContactsEmailOneMin = 3;
export const candidateOrganizationCardContactsEmailOneMax = 254;
export const candidateOrganizationCardContactsPhoneOneMin = 8;
export const candidateOrganizationCardContactsPhoneOneMax = 16;
export const candidateOrganizationCardContactsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const candidateOrganizationCardContactsTelegramOneMin = 6;
export const candidateOrganizationCardContactsTelegramOneMax = 33;
export const candidateOrganizationCardContactsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const candidateOrganizationCardRepresentativesItemNameMax = 100;
export const candidateOrganizationCardRepresentativesItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const candidateOrganizationCardRepresentativesItemJobTitleMax = 100;
export const candidateOrganizationCardRepresentativesItemJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const candidateOrganizationCardRepresentativesMax = 10;
export const CandidateOrganizationCard = zod.object({
"id": zod.uuid().describe('Identifier of the organization.'),
"name": zod.string().min(1).max(candidateOrganizationCardNameMax).regex(candidateOrganizationCardNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"description": zod.union([zod.string().min(1).max(candidateOrganizationCardDescriptionOneMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Description of the organization, or null.'),
"sphere": zod.union([zod.string().min(1).max(candidateOrganizationCardSphereOneMax).regex(candidateOrganizationCardSphereOneRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Field of business of the organization, or null.'),
"contacts": zod.object({
"website": zod.union([zod.string().min(candidateOrganizationCardContactsWebsiteOneMin).max(candidateOrganizationCardContactsWebsiteOneMax).regex(candidateOrganizationCardContactsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(candidateOrganizationCardContactsEmailOneMin).max(candidateOrganizationCardContactsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(candidateOrganizationCardContactsPhoneOneMin).max(candidateOrganizationCardContactsPhoneOneMax).regex(candidateOrganizationCardContactsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(candidateOrganizationCardContactsTelegramOneMin).max(candidateOrganizationCardContactsTelegramOneMax).regex(candidateOrganizationCardContactsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.'),
"representatives": zod.array(zod.object({
"name": zod.string().min(1).max(candidateOrganizationCardRepresentativesItemNameMax).regex(candidateOrganizationCardRepresentativesItemNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(candidateOrganizationCardRepresentativesItemJobTitleMax).regex(candidateOrganizationCardRepresentativesItemJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')).max(candidateOrganizationCardRepresentativesMax).nullish().describe('Representatives in the order the owner gave them. Absent or null means that they are not published on this card, which says nothing about whether the organization has any.'),
"verification_level": zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.')
}).describe('The card of an organization as a candidate sees it: what an invitation shows before the candidate decides. The server builds it from the profile and the verification level and returns it to the owner as the preview of PRD FR07 ("through the eyes of the candidate"); a client never sends it. It holds no membership, no role, no account, no version, and no ground of the verification: a member\'s email address, the number of members, and the history of the organization stay out of it. The card is the same object that the candidate side will return (planned in the invitation contract). Only a candidate who received an invitation from the organization sees it; it is not a public page, and no operation shows it to anyone else until the open question about publishing the names of representatives is decided (152-FZ). The server may leave `representatives` out, and a card without them means that the representatives are not published, not that the organization has none.')
export type CandidateOrganizationCard = zod.input<typeof CandidateOrganizationCard>;
export type CandidateOrganizationCardOutput = zod.output<typeof CandidateOrganizationCard>;
@@ -0,0 +1,65 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const createOrganizationBodyNameMax = 200;
export const createOrganizationBodyNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const createOrganizationBodyDescriptionOneMax = 2000;
export const createOrganizationBodySphereOneMax = 100;
export const createOrganizationBodySphereOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationBodyContactsWebsiteOneMin = 9;
export const createOrganizationBodyContactsWebsiteOneMax = 300;
export const createOrganizationBodyContactsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const createOrganizationBodyContactsEmailOneMin = 3;
export const createOrganizationBodyContactsEmailOneMax = 254;
export const createOrganizationBodyContactsPhoneOneMin = 8;
export const createOrganizationBodyContactsPhoneOneMax = 16;
export const createOrganizationBodyContactsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const createOrganizationBodyContactsTelegramOneMin = 6;
export const createOrganizationBodyContactsTelegramOneMax = 33;
export const createOrganizationBodyContactsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const createOrganizationBodyRepresentativesItemNameMax = 100;
export const createOrganizationBodyRepresentativesItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationBodyRepresentativesItemJobTitleMax = 100;
export const createOrganizationBodyRepresentativesItemJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const createOrganizationBodyRepresentativesMax = 10;
export const CreateOrganizationBody = zod.object({
"name": zod.string().min(1).max(createOrganizationBodyNameMax).regex(createOrganizationBodyNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"description": zod.union([zod.string().min(1).max(createOrganizationBodyDescriptionOneMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"sphere": zod.union([zod.string().min(1).max(createOrganizationBodySphereOneMax).regex(createOrganizationBodySphereOneRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"contacts": zod.object({
"website": zod.union([zod.string().min(createOrganizationBodyContactsWebsiteOneMin).max(createOrganizationBodyContactsWebsiteOneMax).regex(createOrganizationBodyContactsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(createOrganizationBodyContactsEmailOneMin).max(createOrganizationBodyContactsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(createOrganizationBodyContactsPhoneOneMin).max(createOrganizationBodyContactsPhoneOneMax).regex(createOrganizationBodyContactsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(createOrganizationBodyContactsTelegramOneMin).max(createOrganizationBodyContactsTelegramOneMax).regex(createOrganizationBodyContactsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).exactOptional().describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.'),
"representatives": zod.array(zod.object({
"name": zod.string().min(1).max(createOrganizationBodyRepresentativesItemNameMax).regex(createOrganizationBodyRepresentativesItemNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(createOrganizationBodyRepresentativesItemJobTitleMax).regex(createOrganizationBodyRepresentativesItemJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')).max(createOrganizationBodyRepresentativesMax).exactOptional()
}).describe('New organization. Only `name` is required, so a company can start with its name and complete the card later. The creating account becomes the owner of the organization; the body has no field for a role, a membership, an owner, a verification level, or a version, and unknown fields are rejected, so a request cannot set any of them. An absent `description` or `sphere`, and one sent as null, stay unset; an absent `contacts` has every contact unset; an absent `representatives` is an empty list.')
export type CreateOrganizationBody = zod.input<typeof CreateOrganizationBody>;
export type CreateOrganizationBodyOutput = zod.output<typeof CreateOrganizationBody>;
@@ -0,0 +1,19 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const createOrganizationHeadersIdempotencyKeyMax = 255;
export const createOrganizationHeadersIdempotencyKeyRegExp = new RegExp('^[A-Za-z0-9._:-]+$');
export const CreateOrganizationHeaders = zod.object({
"Idempotency-Key": zod.string().min(1).max(createOrganizationHeadersIdempotencyKeyMax).regex(createOrganizationHeadersIdempotencyKeyRegExp)
})
export type CreateOrganizationHeaders = zod.input<typeof CreateOrganizationHeaders>;
export type CreateOrganizationHeadersOutput = zod.output<typeof CreateOrganizationHeaders>;
@@ -0,0 +1,31 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
export * from './candidateOrganizationCard.zod';
export * from './createOrganizationBody.zod';
export * from './createOrganizationHeaders.zod';
export * from './listMyOrganizationsParams.zod';
export * from './membershipState.zod';
export * from './myOrganization.zod';
export * from './myOrganizationList.zod';
export * from './organization.zod';
export * from './organizationContactChannels.zod';
export * from './organizationCreate.zod';
export * from './organizationDescription.zod';
export * from './organizationMembership.zod';
export * from './organizationName.zod';
export * from './organizationRepresentative.zod';
export * from './organizationRole.zod';
export * from './organizationSphere.zod';
export * from './organizationSummary.zod';
export * from './organizationUpdate.zod';
export * from './organizationVerification.zod';
export * from './organizationVerificationBasis.zod';
export * from './organizationVerificationLevel.zod';
export * from './organizationVersion.zod';
export * from './organizationWebsite.zod';
export * from './updateOrganizationBody.zod';
@@ -0,0 +1,23 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const listMyOrganizationsParamsLimitDefault = 20;
export const listMyOrganizationsParamsLimitMax = 100;
export const listMyOrganizationsParamsCursorMax = 512;
export const listMyOrganizationsParamsCursorRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const ListMyOrganizationsParams = zod.object({
"limit": zod.int().min(1).max(listMyOrganizationsParamsLimitMax).default(listMyOrganizationsParamsLimitDefault),
"cursor": zod.string().min(1).max(listMyOrganizationsParamsCursorMax).regex(listMyOrganizationsParamsCursorRegExp).exactOptional()
})
export type ListMyOrganizationsParams = zod.input<typeof ListMyOrganizationsParams>;
export type ListMyOrganizationsParamsOutput = zod.output<typeof ListMyOrganizationsParams>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const MembershipState = zod.enum(['active', 'suspended', 'removed', 'left']).describe('State of a membership. Only `active` gives access: every other state answers as if the account were no member.\n\n- active: the member works in the organization with the role.\n- suspended: access is stopped, and the owner or the platform may restore it.\n- removed: the owner or the platform ended the membership. A removal by the platform is not undone by the owner or by an invitation: the acceptance of an employee invitation and the member management (TASK-082, TASK-084) must not reactivate it on their own. Who removed the member and why become additive fields of the member management.\n- left: the member ended the membership.\n\nOne account has at most one membership per organization, so a former member who returns gets the same membership back in `active`, and the history of the pair is the history of its audit events (planned). The listing of this contract returns only `active` memberships; the other states are listed now so that generated clients accept them when the member management reads them. Adding a state is a contract change.')
export type MembershipState = zod.input<typeof MembershipState>;
export type MembershipStateOutput = zod.output<typeof MembershipState>;
@@ -0,0 +1,29 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const myOrganizationOrganizationNameMax = 200;
export const myOrganizationOrganizationNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const MyOrganization = zod.object({
"organization": zod.object({
"id": zod.uuid().describe('Identifier of the organization, the `org_id` of its paths.'),
"name": zod.string().min(1).max(myOrganizationOrganizationNameMax).regex(myOrganizationOrganizationNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"verification_level": zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.')
}).describe('An organization in the list of the caller\'s organizations: what a switcher needs to name it. The profile, the contacts, and the representatives are in `Organization`.'),
"membership": zod.object({
"organization_id": zod.uuid().describe('Identifier of the organization.'),
"role": zod.enum(['owner', 'recruiter', 'hiring_manager', 'technical_expert']).describe('Role of a member in an organization (PRD 2.2 and the FR07 matrix). The role belongs to the membership, never to the organization or to any editable profile.\n\n- owner: manages the organization and its members, and acts on behalf of the company.\n- recruiter: leads the selection of candidates for all needs.\n- hiring_manager: acts on the needs assigned to the member.\n- technical_expert: refines the requirements of the assigned needs; reads no contacts and sends no invitations.\n\nIn the MVP only the owner acts, so the other roles grant nothing yet: an operation that is not open to a role answers 403 `forbidden`. The full matrix is planned, and applying it changes no field of this contract. Adding a role is a contract change.'),
"state": zod.enum(['active', 'suspended', 'removed', 'left']).describe('State of a membership. Only `active` gives access: every other state answers as if the account were no member.\n\n- active: the member works in the organization with the role.\n- suspended: access is stopped, and the owner or the platform may restore it.\n- removed: the owner or the platform ended the membership. A removal by the platform is not undone by the owner or by an invitation: the acceptance of an employee invitation and the member management (TASK-082, TASK-084) must not reactivate it on their own. Who removed the member and why become additive fields of the member management.\n- left: the member ended the membership.\n\nOne account has at most one membership per organization, so a former member who returns gets the same membership back in `active`, and the history of the pair is the history of its audit events (planned). The listing of this contract returns only `active` memberships; the other states are listed now so that generated clients accept them when the member management reads them. Adding a state is a contract change.'),
"joined_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.').describe('Moment the membership was first created. A member who left and returns keeps the same value, because the pair has one membership; the moment of the latest activation is a planned additive field (`activated_at`, TASK-082).')
}).describe('The membership of the caller in one organization. The caller is the account of the session, so the object holds no account identifier. Only the server sets the role and the state, through the operations that manage members, which are planned; no operation of this contract changes them.')
}).describe('An organization available to the caller together with the caller\'s membership in it.')
export type MyOrganization = zod.input<typeof MyOrganization>;
export type MyOrganizationOutput = zod.output<typeof MyOrganization>;
@@ -0,0 +1,41 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const myOrganizationListItemsItemOrganizationNameMax = 200;
export const myOrganizationListItemsItemOrganizationNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const myOrganizationListItemsMax = 100;
export const myOrganizationListPageNextCursorMax = 512;
export const myOrganizationListPageNextCursorRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const MyOrganizationList = zod.object({
"items": zod.array(zod.object({
"organization": zod.object({
"id": zod.uuid().describe('Identifier of the organization, the `org_id` of its paths.'),
"name": zod.string().min(1).max(myOrganizationListItemsItemOrganizationNameMax).regex(myOrganizationListItemsItemOrganizationNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"verification_level": zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.')
}).describe('An organization in the list of the caller\'s organizations: what a switcher needs to name it. The profile, the contacts, and the representatives are in `Organization`.'),
"membership": zod.object({
"organization_id": zod.uuid().describe('Identifier of the organization.'),
"role": zod.enum(['owner', 'recruiter', 'hiring_manager', 'technical_expert']).describe('Role of a member in an organization (PRD 2.2 and the FR07 matrix). The role belongs to the membership, never to the organization or to any editable profile.\n\n- owner: manages the organization and its members, and acts on behalf of the company.\n- recruiter: leads the selection of candidates for all needs.\n- hiring_manager: acts on the needs assigned to the member.\n- technical_expert: refines the requirements of the assigned needs; reads no contacts and sends no invitations.\n\nIn the MVP only the owner acts, so the other roles grant nothing yet: an operation that is not open to a role answers 403 `forbidden`. The full matrix is planned, and applying it changes no field of this contract. Adding a role is a contract change.'),
"state": zod.enum(['active', 'suspended', 'removed', 'left']).describe('State of a membership. Only `active` gives access: every other state answers as if the account were no member.\n\n- active: the member works in the organization with the role.\n- suspended: access is stopped, and the owner or the platform may restore it.\n- removed: the owner or the platform ended the membership. A removal by the platform is not undone by the owner or by an invitation: the acceptance of an employee invitation and the member management (TASK-082, TASK-084) must not reactivate it on their own. Who removed the member and why become additive fields of the member management.\n- left: the member ended the membership.\n\nOne account has at most one membership per organization, so a former member who returns gets the same membership back in `active`, and the history of the pair is the history of its audit events (planned). The listing of this contract returns only `active` memberships; the other states are listed now so that generated clients accept them when the member management reads them. Adding a state is a contract change.'),
"joined_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.').describe('Moment the membership was first created. A member who left and returns keeps the same value, because the pair has one membership; the moment of the latest activation is a planned additive field (`activated_at`, TASK-082).')
}).describe('The membership of the caller in one organization. The caller is the account of the session, so the object holds no account identifier. Only the server sets the role and the state, through the operations that manage members, which are planned; no operation of this contract changes them.')
}).describe('An organization available to the caller together with the caller\'s membership in it.')).max(myOrganizationListItemsMax).describe('Organizations of the page.'),
"page": zod.object({
"has_more": zod.boolean().describe('Whether another page follows this one.'),
"next_cursor": zod.string().min(1).max(myOrganizationListPageNextCursorMax).regex(myOrganizationListPageNextCursorRegExp).nullable().describe('Opaque cursor of the next page, or null on the last page. Clients must not parse, build, or store it beyond the current listing.')
}).describe('Cursor pagination state of a list response. Lists are ordered by a stable server-defined key. To read the next page, repeat the request with the same filters and `cursor` set to `next_cursor`.')
}).describe('One page of the organizations available to the caller, newest membership first. It holds only organizations where the caller has an `active` membership, so it is also the list of contexts the caller can work in; it never names an organization the caller cannot enter.')
export type MyOrganizationList = zod.input<typeof MyOrganizationList>;
export type MyOrganizationListOutput = zod.output<typeof MyOrganizationList>;
@@ -0,0 +1,130 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const organizationNameMax = 200;
export const organizationNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const organizationDescriptionOneMax = 2000;
export const organizationSphereOneMax = 100;
export const organizationSphereOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationContactsWebsiteOneMin = 9;
export const organizationContactsWebsiteOneMax = 300;
export const organizationContactsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const organizationContactsEmailOneMin = 3;
export const organizationContactsEmailOneMax = 254;
export const organizationContactsPhoneOneMin = 8;
export const organizationContactsPhoneOneMax = 16;
export const organizationContactsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const organizationContactsTelegramOneMin = 6;
export const organizationContactsTelegramOneMax = 33;
export const organizationContactsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const organizationRepresentativesItemNameMax = 100;
export const organizationRepresentativesItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationRepresentativesItemJobTitleMax = 100;
export const organizationRepresentativesItemJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationRepresentativesMax = 10;
export const organizationCandidateCardNameMax = 200;
export const organizationCandidateCardNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const organizationCandidateCardDescriptionOneMax = 2000;
export const organizationCandidateCardSphereOneMax = 100;
export const organizationCandidateCardSphereOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationCandidateCardContactsWebsiteOneMin = 9;
export const organizationCandidateCardContactsWebsiteOneMax = 300;
export const organizationCandidateCardContactsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const organizationCandidateCardContactsEmailOneMin = 3;
export const organizationCandidateCardContactsEmailOneMax = 254;
export const organizationCandidateCardContactsPhoneOneMin = 8;
export const organizationCandidateCardContactsPhoneOneMax = 16;
export const organizationCandidateCardContactsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const organizationCandidateCardContactsTelegramOneMin = 6;
export const organizationCandidateCardContactsTelegramOneMax = 33;
export const organizationCandidateCardContactsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const organizationCandidateCardRepresentativesItemNameMax = 100;
export const organizationCandidateCardRepresentativesItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationCandidateCardRepresentativesItemJobTitleMax = 100;
export const organizationCandidateCardRepresentativesItemJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationCandidateCardRepresentativesMax = 10;
export const Organization = zod.object({
"id": zod.uuid().describe('Identifier of the organization, the `org_id` of every organization-scoped path. It never changes.'),
"version": zod.int().min(1).describe('Version of the profile of an organization. Creation makes version 1, and every committed change of the profile advances it by exactly one. A change carries the version the client read as `expected_version`. Only the profile has a version: the memberships and the verification level of the organization do not advance it.'),
"name": zod.string().min(1).max(organizationNameMax).regex(organizationNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"description": zod.union([zod.string().min(1).max(organizationDescriptionOneMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Description of the organization, or null.'),
"sphere": zod.union([zod.string().min(1).max(organizationSphereOneMax).regex(organizationSphereOneRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Field of business of the organization, or null.'),
"contacts": zod.object({
"website": zod.union([zod.string().min(organizationContactsWebsiteOneMin).max(organizationContactsWebsiteOneMax).regex(organizationContactsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(organizationContactsEmailOneMin).max(organizationContactsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(organizationContactsPhoneOneMin).max(organizationContactsPhoneOneMax).regex(organizationContactsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(organizationContactsTelegramOneMin).max(organizationContactsTelegramOneMax).regex(organizationContactsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.'),
"representatives": zod.array(zod.object({
"name": zod.string().min(1).max(organizationRepresentativesItemNameMax).regex(organizationRepresentativesItemNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(organizationRepresentativesItemJobTitleMax).regex(organizationRepresentativesItemJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')).max(organizationRepresentativesMax).describe('Representatives in the order the owner gave them.'),
"verification": zod.object({
"level": zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.'),
"basis": zod.enum(['confirmed_email', 'corporate_domain', 'requisites_and_authority', 'manual_review', 'partner_status']).describe('Ground of the current verification level, the reason a cabinet can show next to it.\n\n- confirmed_email: the confirmed email of the creating account (e0).\n- corporate_domain: a corporate email and a verified domain (e1).\n- requisites_and_authority: a check of the requisites and of the authority (e2).\n- manual_review: a manual check by the platform (e3).\n- partner_status: a partner status (e3).\n\nEach level has its own bases, so a level and a basis that do not belong together never occur. Adding a value is a contract change.'),
"changed_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.').describe('Moment the level was set to its current value; for a new organization, the creation time.')
}).describe('Verification level of an organization with its ground and the time it was set. It is read-only everywhere in this contract: the server sets it, and no request carries it. The scope of the check and the history of changes (PRD FR07) are planned as additive fields and a separate history with the first verification process.'),
"candidate_card": zod.object({
"id": zod.uuid().describe('Identifier of the organization.'),
"name": zod.string().min(1).max(organizationCandidateCardNameMax).regex(organizationCandidateCardNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"description": zod.union([zod.string().min(1).max(organizationCandidateCardDescriptionOneMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Description of the organization, or null.'),
"sphere": zod.union([zod.string().min(1).max(organizationCandidateCardSphereOneMax).regex(organizationCandidateCardSphereOneRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.'),zod.null()]).describe('Field of business of the organization, or null.'),
"contacts": zod.object({
"website": zod.union([zod.string().min(organizationCandidateCardContactsWebsiteOneMin).max(organizationCandidateCardContactsWebsiteOneMax).regex(organizationCandidateCardContactsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(organizationCandidateCardContactsEmailOneMin).max(organizationCandidateCardContactsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(organizationCandidateCardContactsPhoneOneMin).max(organizationCandidateCardContactsPhoneOneMax).regex(organizationCandidateCardContactsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(organizationCandidateCardContactsTelegramOneMin).max(organizationCandidateCardContactsTelegramOneMax).regex(organizationCandidateCardContactsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.'),
"representatives": zod.array(zod.object({
"name": zod.string().min(1).max(organizationCandidateCardRepresentativesItemNameMax).regex(organizationCandidateCardRepresentativesItemNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(organizationCandidateCardRepresentativesItemJobTitleMax).regex(organizationCandidateCardRepresentativesItemJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')).max(organizationCandidateCardRepresentativesMax).nullish().describe('Representatives in the order the owner gave them. Absent or null means that they are not published on this card, which says nothing about whether the organization has any.'),
"verification_level": zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.')
}).describe('The card of an organization as a candidate sees it: what an invitation shows before the candidate decides. The server builds it from the profile and the verification level and returns it to the owner as the preview of PRD FR07 ("through the eyes of the candidate"); a client never sends it. It holds no membership, no role, no account, no version, and no ground of the verification: a member\'s email address, the number of members, and the history of the organization stay out of it. The card is the same object that the candidate side will return (planned in the invitation contract). Only a candidate who received an invitation from the organization sees it; it is not a public page, and no operation shows it to anyone else until the open question about publishing the names of representatives is decided (152-FZ). The server may leave `representatives` out, and a card without them means that the representatives are not published, not that the organization has none.'),
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),
"updated_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.')
}).describe('Organization as its members read it: the profile that the owner edits, the verification level that only the server sets, and the card that a candidate sees. It never contains a role, a membership, the members of the organization, or an account identifier, so no field of it can raise a right: the role of the caller is in `OrganizationMembership` and comes only from the membership held by the server. The profile fields repeat in `candidate_card`, which is the candidate\'s view of them; the client reads the profile fields for the form and `candidate_card` for the preview.')
export type Organization = zod.input<typeof Organization>;
export type OrganizationOutput = zod.output<typeof Organization>;
@@ -0,0 +1,36 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const organizationContactChannelsWebsiteOneMin = 9;
export const organizationContactChannelsWebsiteOneMax = 300;
export const organizationContactChannelsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const organizationContactChannelsEmailOneMin = 3;
export const organizationContactChannelsEmailOneMax = 254;
export const organizationContactChannelsPhoneOneMin = 8;
export const organizationContactChannelsPhoneOneMax = 16;
export const organizationContactChannelsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const organizationContactChannelsTelegramOneMin = 6;
export const organizationContactChannelsTelegramOneMax = 33;
export const organizationContactChannelsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const OrganizationContactChannels = zod.object({
"website": zod.union([zod.string().min(organizationContactChannelsWebsiteOneMin).max(organizationContactChannelsWebsiteOneMax).regex(organizationContactChannelsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(organizationContactChannelsEmailOneMin).max(organizationContactChannelsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(organizationContactChannelsPhoneOneMin).max(organizationContactChannelsPhoneOneMax).regex(organizationContactChannelsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(organizationContactChannelsTelegramOneMin).max(organizationContactChannelsTelegramOneMax).regex(organizationContactChannelsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.')
export type OrganizationContactChannels = zod.input<typeof OrganizationContactChannels>;
export type OrganizationContactChannelsOutput = zod.output<typeof OrganizationContactChannels>;
@@ -0,0 +1,65 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const organizationCreateNameMax = 200;
export const organizationCreateNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const organizationCreateDescriptionOneMax = 2000;
export const organizationCreateSphereOneMax = 100;
export const organizationCreateSphereOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationCreateContactsWebsiteOneMin = 9;
export const organizationCreateContactsWebsiteOneMax = 300;
export const organizationCreateContactsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const organizationCreateContactsEmailOneMin = 3;
export const organizationCreateContactsEmailOneMax = 254;
export const organizationCreateContactsPhoneOneMin = 8;
export const organizationCreateContactsPhoneOneMax = 16;
export const organizationCreateContactsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const organizationCreateContactsTelegramOneMin = 6;
export const organizationCreateContactsTelegramOneMax = 33;
export const organizationCreateContactsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const organizationCreateRepresentativesItemNameMax = 100;
export const organizationCreateRepresentativesItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationCreateRepresentativesItemJobTitleMax = 100;
export const organizationCreateRepresentativesItemJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationCreateRepresentativesMax = 10;
export const OrganizationCreate = zod.object({
"name": zod.string().min(1).max(organizationCreateNameMax).regex(organizationCreateNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"description": zod.union([zod.string().min(1).max(organizationCreateDescriptionOneMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"sphere": zod.union([zod.string().min(1).max(organizationCreateSphereOneMax).regex(organizationCreateSphereOneRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"contacts": zod.object({
"website": zod.union([zod.string().min(organizationCreateContactsWebsiteOneMin).max(organizationCreateContactsWebsiteOneMax).regex(organizationCreateContactsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(organizationCreateContactsEmailOneMin).max(organizationCreateContactsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(organizationCreateContactsPhoneOneMin).max(organizationCreateContactsPhoneOneMax).regex(organizationCreateContactsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(organizationCreateContactsTelegramOneMin).max(organizationCreateContactsTelegramOneMax).regex(organizationCreateContactsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).exactOptional().describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.'),
"representatives": zod.array(zod.object({
"name": zod.string().min(1).max(organizationCreateRepresentativesItemNameMax).regex(organizationCreateRepresentativesItemNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(organizationCreateRepresentativesItemJobTitleMax).regex(organizationCreateRepresentativesItemJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')).max(organizationCreateRepresentativesMax).exactOptional()
}).describe('New organization. Only `name` is required, so a company can start with its name and complete the card later. The creating account becomes the owner of the organization; the body has no field for a role, a membership, an owner, a verification level, or a version, and unknown fields are rejected, so a request cannot set any of them. An absent `description` or `sphere`, and one sent as null, stay unset; an absent `contacts` has every contact unset; an absent `representatives` is an empty list.')
export type OrganizationCreate = zod.input<typeof OrganizationCreate>;
export type OrganizationCreateOutput = zod.output<typeof OrganizationCreate>;
@@ -0,0 +1,15 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationDescriptionMax = 2000;
export const OrganizationDescription = zod.string().min(1).max(OrganizationDescriptionMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.')
export type OrganizationDescription = zod.input<typeof OrganizationDescription>;
export type OrganizationDescriptionOutput = zod.output<typeof OrganizationDescription>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationMembership = zod.object({
"organization_id": zod.uuid().describe('Identifier of the organization.'),
"role": zod.enum(['owner', 'recruiter', 'hiring_manager', 'technical_expert']).describe('Role of a member in an organization (PRD 2.2 and the FR07 matrix). The role belongs to the membership, never to the organization or to any editable profile.\n\n- owner: manages the organization and its members, and acts on behalf of the company.\n- recruiter: leads the selection of candidates for all needs.\n- hiring_manager: acts on the needs assigned to the member.\n- technical_expert: refines the requirements of the assigned needs; reads no contacts and sends no invitations.\n\nIn the MVP only the owner acts, so the other roles grant nothing yet: an operation that is not open to a role answers 403 `forbidden`. The full matrix is planned, and applying it changes no field of this contract. Adding a role is a contract change.'),
"state": zod.enum(['active', 'suspended', 'removed', 'left']).describe('State of a membership. Only `active` gives access: every other state answers as if the account were no member.\n\n- active: the member works in the organization with the role.\n- suspended: access is stopped, and the owner or the platform may restore it.\n- removed: the owner or the platform ended the membership. A removal by the platform is not undone by the owner or by an invitation: the acceptance of an employee invitation and the member management (TASK-082, TASK-084) must not reactivate it on their own. Who removed the member and why become additive fields of the member management.\n- left: the member ended the membership.\n\nOne account has at most one membership per organization, so a former member who returns gets the same membership back in `active`, and the history of the pair is the history of its audit events (planned). The listing of this contract returns only `active` memberships; the other states are listed now so that generated clients accept them when the member management reads them. Adding a state is a contract change.'),
"joined_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.').describe('Moment the membership was first created. A member who left and returns keeps the same value, because the pair has one membership; the moment of the latest activation is a planned additive field (`activated_at`, TASK-082).')
}).describe('The membership of the caller in one organization. The caller is the account of the session, so the object holds no account identifier. Only the server sets the role and the state, through the operations that manage members, which are planned; no operation of this contract changes them.')
export type OrganizationMembership = zod.input<typeof OrganizationMembership>;
export type OrganizationMembershipOutput = zod.output<typeof OrganizationMembership>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationNameMax = 200;
export const OrganizationNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const OrganizationName = zod.string().min(1).max(OrganizationNameMax).regex(OrganizationNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.')
export type OrganizationName = zod.input<typeof OrganizationName>;
export type OrganizationNameOutput = zod.output<typeof OrganizationName>;
@@ -0,0 +1,24 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const organizationRepresentativeNameMax = 100;
export const organizationRepresentativeNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationRepresentativeJobTitleMax = 100;
export const organizationRepresentativeJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const OrganizationRepresentative = zod.object({
"name": zod.string().min(1).max(organizationRepresentativeNameMax).regex(organizationRepresentativeNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(organizationRepresentativeJobTitleMax).regex(organizationRepresentativeJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')
export type OrganizationRepresentative = zod.input<typeof OrganizationRepresentative>;
export type OrganizationRepresentativeOutput = zod.output<typeof OrganizationRepresentative>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationRole = zod.enum(['owner', 'recruiter', 'hiring_manager', 'technical_expert']).describe('Role of a member in an organization (PRD 2.2 and the FR07 matrix). The role belongs to the membership, never to the organization or to any editable profile.\n\n- owner: manages the organization and its members, and acts on behalf of the company.\n- recruiter: leads the selection of candidates for all needs.\n- hiring_manager: acts on the needs assigned to the member.\n- technical_expert: refines the requirements of the assigned needs; reads no contacts and sends no invitations.\n\nIn the MVP only the owner acts, so the other roles grant nothing yet: an operation that is not open to a role answers 403 `forbidden`. The full matrix is planned, and applying it changes no field of this contract. Adding a role is a contract change.')
export type OrganizationRole = zod.input<typeof OrganizationRole>;
export type OrganizationRoleOutput = zod.output<typeof OrganizationRole>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationSphereMax = 100;
export const OrganizationSphereRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const OrganizationSphere = zod.string().min(1).max(OrganizationSphereMax).regex(OrganizationSphereRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.')
export type OrganizationSphere = zod.input<typeof OrganizationSphere>;
export type OrganizationSphereOutput = zod.output<typeof OrganizationSphere>;
@@ -0,0 +1,21 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const organizationSummaryNameMax = 200;
export const organizationSummaryNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const OrganizationSummary = zod.object({
"id": zod.uuid().describe('Identifier of the organization, the `org_id` of its paths.'),
"name": zod.string().min(1).max(organizationSummaryNameMax).regex(organizationSummaryNameRegExp).describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"verification_level": zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.')
}).describe('An organization in the list of the caller\'s organizations: what a switcher needs to name it. The profile, the contacts, and the representatives are in `Organization`.')
export type OrganizationSummary = zod.input<typeof OrganizationSummary>;
export type OrganizationSummaryOutput = zod.output<typeof OrganizationSummary>;
@@ -0,0 +1,67 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const organizationUpdateNameMax = 200;
export const organizationUpdateNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const organizationUpdateDescriptionOneMax = 2000;
export const organizationUpdateSphereOneMax = 100;
export const organizationUpdateSphereOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationUpdateContactsWebsiteOneMin = 9;
export const organizationUpdateContactsWebsiteOneMax = 300;
export const organizationUpdateContactsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const organizationUpdateContactsEmailOneMin = 3;
export const organizationUpdateContactsEmailOneMax = 254;
export const organizationUpdateContactsPhoneOneMin = 8;
export const organizationUpdateContactsPhoneOneMax = 16;
export const organizationUpdateContactsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const organizationUpdateContactsTelegramOneMin = 6;
export const organizationUpdateContactsTelegramOneMax = 33;
export const organizationUpdateContactsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const organizationUpdateRepresentativesItemNameMax = 100;
export const organizationUpdateRepresentativesItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationUpdateRepresentativesItemJobTitleMax = 100;
export const organizationUpdateRepresentativesItemJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const organizationUpdateRepresentativesMax = 10;
export const OrganizationUpdate = zod.object({
"expected_version": zod.int().min(1).describe('Version of the profile of an organization. Creation makes version 1, and every committed change of the profile advances it by exactly one. A change carries the version the client read as `expected_version`. Only the profile has a version: the memberships and the verification level of the organization do not advance it.'),
"name": zod.string().min(1).max(organizationUpdateNameMax).regex(organizationUpdateNameRegExp).exactOptional().describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"description": zod.union([zod.string().min(1).max(organizationUpdateDescriptionOneMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"sphere": zod.union([zod.string().min(1).max(organizationUpdateSphereOneMax).regex(organizationUpdateSphereOneRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"contacts": zod.object({
"website": zod.union([zod.string().min(organizationUpdateContactsWebsiteOneMin).max(organizationUpdateContactsWebsiteOneMax).regex(organizationUpdateContactsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(organizationUpdateContactsEmailOneMin).max(organizationUpdateContactsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(organizationUpdateContactsPhoneOneMin).max(organizationUpdateContactsPhoneOneMax).regex(organizationUpdateContactsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(organizationUpdateContactsTelegramOneMin).max(organizationUpdateContactsTelegramOneMax).regex(organizationUpdateContactsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).exactOptional().describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.'),
"representatives": zod.array(zod.object({
"name": zod.string().min(1).max(organizationUpdateRepresentativesItemNameMax).regex(organizationUpdateRepresentativesItemNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(organizationUpdateRepresentativesItemJobTitleMax).regex(organizationUpdateRepresentativesItemJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')).max(organizationUpdateRepresentativesMax).exactOptional()
}).describe('Change of the profile of an organization over the version the client read. Each field present replaces that field as a whole and an absent field stays unchanged; `contacts` and `representatives` are replaced entirely and never merged, and a representative left out of a sent list is removed. `description` and `sphere` sent as null become unset; `name`, `contacts`, and `representatives` cannot be null. The body can change the profile only. It has no field for a role, a membership, an owner, a verification level, a basis, or a card, and unknown fields are rejected, so editing the profile can neither raise a right nor raise the trust level of the organization; both change only through processes of the server.')
export type OrganizationUpdate = zod.input<typeof OrganizationUpdate>;
export type OrganizationUpdateOutput = zod.output<typeof OrganizationUpdate>;
@@ -0,0 +1,16 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationVerification = zod.object({
"level": zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.'),
"basis": zod.enum(['confirmed_email', 'corporate_domain', 'requisites_and_authority', 'manual_review', 'partner_status']).describe('Ground of the current verification level, the reason a cabinet can show next to it.\n\n- confirmed_email: the confirmed email of the creating account (e0).\n- corporate_domain: a corporate email and a verified domain (e1).\n- requisites_and_authority: a check of the requisites and of the authority (e2).\n- manual_review: a manual check by the platform (e3).\n- partner_status: a partner status (e3).\n\nEach level has its own bases, so a level and a basis that do not belong together never occur. Adding a value is a contract change.'),
"changed_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.').describe('Moment the level was set to its current value; for a new organization, the creation time.')
}).describe('Verification level of an organization with its ground and the time it was set. It is read-only everywhere in this contract: the server sets it, and no request carries it. The scope of the check and the history of changes (PRD FR07) are planned as additive fields and a separate history with the first verification process.')
export type OrganizationVerification = zod.input<typeof OrganizationVerification>;
export type OrganizationVerificationOutput = zod.output<typeof OrganizationVerification>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationVerificationBasis = zod.enum(['confirmed_email', 'corporate_domain', 'requisites_and_authority', 'manual_review', 'partner_status']).describe('Ground of the current verification level, the reason a cabinet can show next to it.\n\n- confirmed_email: the confirmed email of the creating account (e0).\n- corporate_domain: a corporate email and a verified domain (e1).\n- requisites_and_authority: a check of the requisites and of the authority (e2).\n- manual_review: a manual check by the platform (e3).\n- partner_status: a partner status (e3).\n\nEach level has its own bases, so a level and a basis that do not belong together never occur. Adding a value is a contract change.')
export type OrganizationVerificationBasis = zod.input<typeof OrganizationVerificationBasis>;
export type OrganizationVerificationBasisOutput = zod.output<typeof OrganizationVerificationBasis>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationVerificationLevel = zod.enum(['e0', 'e1', 'e2', 'e3']).describe('Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.\n\n- e0: the confirmed email of the account that created the organization. Every new organization starts here.\n- e1: a corporate email, a verified domain, and a link with the organization.\n- e2: a check of the requisites and of the authority of the person.\n- e3: a manual check or a partner status.\n\nThe server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.')
export type OrganizationVerificationLevel = zod.input<typeof OrganizationVerificationLevel>;
export type OrganizationVerificationLevelOutput = zod.output<typeof OrganizationVerificationLevel>;
@@ -0,0 +1,14 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationVersion = zod.int().min(1).describe('Version of the profile of an organization. Creation makes version 1, and every committed change of the profile advances it by exactly one. A change carries the version the client read as `expected_version`. Only the profile has a version: the memberships and the verification level of the organization do not advance it.')
export type OrganizationVersion = zod.input<typeof OrganizationVersion>;
export type OrganizationVersionOutput = zod.output<typeof OrganizationVersion>;
@@ -0,0 +1,18 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OrganizationWebsiteMin = 9;
export const OrganizationWebsiteMax = 300;
export const OrganizationWebsiteRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const OrganizationWebsite = zod.string().min(OrganizationWebsiteMin).max(OrganizationWebsiteMax).regex(OrganizationWebsiteRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.')
export type OrganizationWebsite = zod.input<typeof OrganizationWebsite>;
export type OrganizationWebsiteOutput = zod.output<typeof OrganizationWebsite>;
@@ -0,0 +1,67 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const updateOrganizationBodyNameMax = 200;
export const updateOrganizationBodyNameRegExp = new RegExp('^\\S(?:[^\\n\\r]*\\S)?$');
export const updateOrganizationBodyDescriptionOneMax = 2000;
export const updateOrganizationBodySphereOneMax = 100;
export const updateOrganizationBodySphereOneRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationBodyContactsWebsiteOneMin = 9;
export const updateOrganizationBodyContactsWebsiteOneMax = 300;
export const updateOrganizationBodyContactsWebsiteOneRegExp = new RegExp('^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$');
export const updateOrganizationBodyContactsEmailOneMin = 3;
export const updateOrganizationBodyContactsEmailOneMax = 254;
export const updateOrganizationBodyContactsPhoneOneMin = 8;
export const updateOrganizationBodyContactsPhoneOneMax = 16;
export const updateOrganizationBodyContactsPhoneOneRegExp = new RegExp('^\\+[1-9][0-9]{6,14}$');
export const updateOrganizationBodyContactsTelegramOneMin = 6;
export const updateOrganizationBodyContactsTelegramOneMax = 33;
export const updateOrganizationBodyContactsTelegramOneRegExp = new RegExp('^@[A-Za-z0-9_]{5,32}$');
export const updateOrganizationBodyRepresentativesItemNameMax = 100;
export const updateOrganizationBodyRepresentativesItemNameRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationBodyRepresentativesItemJobTitleMax = 100;
export const updateOrganizationBodyRepresentativesItemJobTitleRegExp = new RegExp('^\\S(?:.*\\S)?$');
export const updateOrganizationBodyRepresentativesMax = 10;
export const UpdateOrganizationBody = zod.object({
"expected_version": zod.int().min(1).describe('Version of the profile of an organization. Creation makes version 1, and every committed change of the profile advances it by exactly one. A change carries the version the client read as `expected_version`. Only the profile has a version: the memberships and the verification level of the organization do not advance it.'),
"name": zod.string().min(1).max(updateOrganizationBodyNameMax).regex(updateOrganizationBodyNameRegExp).exactOptional().describe('Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.'),
"description": zod.union([zod.string().min(1).max(updateOrganizationBodyDescriptionOneMax).describe('What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"sphere": zod.union([zod.string().min(1).max(updateOrganizationBodySphereOneMax).regex(updateOrganizationBodySphereOneRegExp).describe('Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.'),zod.null()]).exactOptional(),
"contacts": zod.object({
"website": zod.union([zod.string().min(updateOrganizationBodyContactsWebsiteOneMin).max(updateOrganizationBodyContactsWebsiteOneMax).regex(updateOrganizationBodyContactsWebsiteOneRegExp).describe('Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'),zod.null()]),
"email": zod.union([zod.email().min(updateOrganizationBodyContactsEmailOneMin).max(updateOrganizationBodyContactsEmailOneMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),zod.null()]).describe('Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.'),
"phone": zod.union([zod.string().min(updateOrganizationBodyContactsPhoneOneMin).max(updateOrganizationBodyContactsPhoneOneMax).regex(updateOrganizationBodyContactsPhoneOneRegExp).describe('Phone number in the E.164 format, for example +70000000000.'),zod.null()]).describe('Public phone number of the organization, or null.'),
"telegram": zod.union([zod.string().min(updateOrganizationBodyContactsTelegramOneMin).max(updateOrganizationBodyContactsTelegramOneMax).regex(updateOrganizationBodyContactsTelegramOneRegExp).describe('Telegram username with the leading @.'),zod.null()]).describe('Public Telegram account of the organization, or null.')
}).exactOptional().describe('Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.'),
"representatives": zod.array(zod.object({
"name": zod.string().min(1).max(updateOrganizationBodyRepresentativesItemNameMax).regex(updateOrganizationBodyRepresentativesItemNameRegExp).describe('Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.'),
"job_title": zod.string().min(1).max(updateOrganizationBodyRepresentativesItemJobTitleMax).regex(updateOrganizationBodyRepresentativesItemJobTitleRegExp).describe('Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.')
}).describe('A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.')).max(updateOrganizationBodyRepresentativesMax).exactOptional()
}).describe('Change of the profile of an organization over the version the client read. Each field present replaces that field as a whole and an absent field stays unchanged; `contacts` and `representatives` are replaced entirely and never merged, and a representative left out of a sent list is removed. `description` and `sphere` sent as null become unset; `name`, `contacts`, and `representatives` cannot be null. The body can change the profile only. It has no field for a role, a membership, an owner, a verification level, a basis, or a card, and unknown fields are rejected, so editing the profile can neither raise a right nor raise the trust level of the organization; both change only through processes of the server.')
export type UpdateOrganizationBody = zod.input<typeof UpdateOrganizationBody>;
export type UpdateOrganizationBodyOutput = zod.output<typeof UpdateOrganizationBody>;