mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-15 19:52:15 +01:00
add pending email to UserResource and update openapi client
This commit is contained in:
committed by
Constantin Graf
parent
19e1edca31
commit
7b6cdf1d45
@@ -28,6 +28,8 @@ class UserResource extends BaseResource
|
|||||||
'name' => $this->resource->name,
|
'name' => $this->resource->name,
|
||||||
/** @var string $email Email of user */
|
/** @var string $email Email of user */
|
||||||
'email' => $this->resource->email,
|
'email' => $this->resource->email,
|
||||||
|
/** @var string|null $pending_email Email address awaiting verification (set when the user has requested an email change but not yet verified the new address) */
|
||||||
|
'pending_email' => $this->resource->pending_email,
|
||||||
/** @var string $profile_photo_url Profile photo URL */
|
/** @var string $profile_photo_url Profile photo URL */
|
||||||
'profile_photo_url' => $this->resource->profile_photo_url,
|
'profile_photo_url' => $this->resource->profile_photo_url,
|
||||||
/** @var string $timezone Timezone (f.e. Europe/Berlin or America/New_York) */
|
/** @var string $timezone Timezone (f.e. Europe/Berlin or America/New_York) */
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class UserFactory extends Factory
|
|||||||
return [
|
return [
|
||||||
'name' => $this->faker->name(),
|
'name' => $this->faker->name(),
|
||||||
'email' => $this->faker->unique()->safeEmail(),
|
'email' => $this->faker->unique()->safeEmail(),
|
||||||
|
'pending_email' => null,
|
||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||||
'two_factor_secret' => null,
|
'two_factor_secret' => null,
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ export type CreateInvoiceBody = ZodiosBodyByAlias<SolidTimeApi, 'createInvoice'>
|
|||||||
|
|
||||||
export type UpdateInvoiceBody = ZodiosBodyByAlias<SolidTimeApi, 'updateInvoice'>;
|
export type UpdateInvoiceBody = ZodiosBodyByAlias<SolidTimeApi, 'updateInvoice'>;
|
||||||
|
|
||||||
|
export type User = ZodiosResponseByAlias<SolidTimeApi, 'getMe'>['data'];
|
||||||
|
export type UpdateUserBody = ZodiosBodyByAlias<SolidTimeApi, 'updateUser'>;
|
||||||
|
|
||||||
const api = createApiClient('/api', { validate: 'none' });
|
const api = createApiClient('/api', { validate: 'none' });
|
||||||
|
|
||||||
export { createApiClient, api };
|
export { createApiClient, api };
|
||||||
|
|||||||
@@ -688,11 +688,22 @@ const UserResource = z
|
|||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
email: z.string(),
|
email: z.string(),
|
||||||
|
pending_email: z.union([z.string(), z.null()]),
|
||||||
profile_photo_url: z.string(),
|
profile_photo_url: z.string(),
|
||||||
timezone: z.string(),
|
timezone: z.string(),
|
||||||
week_start: Weekday,
|
week_start: Weekday,
|
||||||
})
|
})
|
||||||
.passthrough();
|
.passthrough();
|
||||||
|
const UserUpdateRequest = z
|
||||||
|
.object({
|
||||||
|
name: z.string(),
|
||||||
|
email: z.string(),
|
||||||
|
photo: z.union([z.string(), z.null()]),
|
||||||
|
timezone: z.string(),
|
||||||
|
week_start: Weekday,
|
||||||
|
})
|
||||||
|
.partial()
|
||||||
|
.passthrough();
|
||||||
const PersonalMembershipResource = z
|
const PersonalMembershipResource = z
|
||||||
.object({
|
.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
@@ -764,6 +775,7 @@ export const schemas = {
|
|||||||
TimeEntryUpdateMultipleRequest,
|
TimeEntryUpdateMultipleRequest,
|
||||||
TimeEntryUpdateRequest,
|
TimeEntryUpdateRequest,
|
||||||
UserResource,
|
UserResource,
|
||||||
|
UserUpdateRequest,
|
||||||
PersonalMembershipResource,
|
PersonalMembershipResource,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4467,7 +4479,7 @@ The report is considered public if the `is_public` field is set to &#x
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
path: '/v1/users/me',
|
path: '/v1/users/me',
|
||||||
alias: 'getMe',
|
alias: 'getMe',
|
||||||
description: `This endpoint is independent of organization.`,
|
description: `This endpoint is independent of the organization.`,
|
||||||
requestFormat: 'json',
|
requestFormat: 'json',
|
||||||
response: z.object({ data: UserResource }).passthrough(),
|
response: z.object({ data: UserResource }).passthrough(),
|
||||||
errors: [
|
errors: [
|
||||||
@@ -4483,6 +4495,79 @@ The report is considered public if the `is_public` field is set to &#x
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
method: 'put',
|
||||||
|
path: '/v1/users/:user',
|
||||||
|
alias: 'updateUser',
|
||||||
|
description: `This endpoint is independent of the organization.`,
|
||||||
|
requestFormat: 'json',
|
||||||
|
parameters: [
|
||||||
|
{
|
||||||
|
name: 'body',
|
||||||
|
type: 'Body',
|
||||||
|
schema: UserUpdateRequest,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'user',
|
||||||
|
type: 'Path',
|
||||||
|
schema: z.string(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
response: z.object({ data: UserResource }).passthrough(),
|
||||||
|
errors: [
|
||||||
|
{
|
||||||
|
status: 401,
|
||||||
|
description: `Unauthenticated`,
|
||||||
|
schema: z.object({ message: z.string() }).passthrough(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 403,
|
||||||
|
description: `Authorization error`,
|
||||||
|
schema: z.object({ message: z.string() }).passthrough(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 422,
|
||||||
|
description: `Validation error`,
|
||||||
|
schema: z
|
||||||
|
.object({ message: z.string(), errors: z.record(z.array(z.string())) })
|
||||||
|
.passthrough(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: 'post',
|
||||||
|
path: '/v1/users/:user/resend-email-verification',
|
||||||
|
alias: 'resendUserEmailVerification',
|
||||||
|
description: `This endpoint is independent of the organization.`,
|
||||||
|
requestFormat: 'json',
|
||||||
|
parameters: [
|
||||||
|
{
|
||||||
|
name: 'user',
|
||||||
|
type: 'Path',
|
||||||
|
schema: z.string(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
response: z.void(),
|
||||||
|
errors: [
|
||||||
|
{
|
||||||
|
status: 400,
|
||||||
|
description: `API exception`,
|
||||||
|
schema: z
|
||||||
|
.object({ error: z.boolean(), key: z.string(), message: z.string() })
|
||||||
|
.passthrough(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 401,
|
||||||
|
description: `Unauthenticated`,
|
||||||
|
schema: z.object({ message: z.string() }).passthrough(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 403,
|
||||||
|
description: `Authorization error`,
|
||||||
|
schema: z.object({ message: z.string() }).passthrough(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
method: 'get',
|
method: 'get',
|
||||||
path: '/v1/users/me/api-tokens',
|
path: '/v1/users/me/api-tokens',
|
||||||
|
|||||||
1
resources/js/types/models.d.ts
vendored
1
resources/js/types/models.d.ts
vendored
@@ -63,6 +63,7 @@ export interface User {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
|
pending_email: string | null;
|
||||||
email_verified_at: string | null;
|
email_verified_at: string | null;
|
||||||
password?: string;
|
password?: string;
|
||||||
remember_token?: string | null;
|
remember_token?: string | null;
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ export interface User {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
|
pending_email: string | null;
|
||||||
email_verified_at: string | null;
|
email_verified_at: string | null;
|
||||||
password?: string;
|
password?: string;
|
||||||
remember_token?: string | null;
|
remember_token?: string | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user