add pending email to UserResource and update openapi client

This commit is contained in:
Gregor Vostrak
2026-05-26 18:02:15 +02:00
parent 414b5d3294
commit dad686d107
6 changed files with 94 additions and 1 deletions

View File

@@ -28,6 +28,8 @@ class UserResource extends BaseResource
'name' => $this->resource->name,
/** @var string $email Email of user */
'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 */
'profile_photo_url' => $this->resource->profile_photo_url,
/** @var string $timezone Timezone (f.e. Europe/Berlin or America/New_York) */

View File

@@ -28,6 +28,7 @@ class UserFactory extends Factory
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'pending_email' => null,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'two_factor_secret' => null,

View File

@@ -122,6 +122,9 @@ export type CreateInvoiceBody = ZodiosBodyByAlias<SolidTimeApi, 'createInvoice'>
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' });
export { createApiClient, api };

View File

@@ -688,11 +688,22 @@ const UserResource = z
id: z.string(),
name: z.string(),
email: z.string(),
pending_email: z.union([z.string(), z.null()]),
profile_photo_url: z.string(),
timezone: z.string(),
week_start: Weekday,
})
.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
.object({
id: z.string(),
@@ -764,6 +775,7 @@ export const schemas = {
TimeEntryUpdateMultipleRequest,
TimeEntryUpdateRequest,
UserResource,
UserUpdateRequest,
PersonalMembershipResource,
};
@@ -4419,7 +4431,7 @@ The report is considered public if the &#x60;is_public&#x60; field is set to &#x
method: 'get',
path: '/v1/users/me',
alias: 'getMe',
description: `This endpoint is independent of organization.`,
description: `This endpoint is independent of the organization.`,
requestFormat: 'json',
response: z.object({ data: UserResource }).passthrough(),
errors: [
@@ -4435,6 +4447,79 @@ The report is considered public if the &#x60;is_public&#x60; 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',
path: '/v1/users/me/api-tokens',

View File

@@ -63,6 +63,7 @@ export interface User {
id: string;
name: string;
email: string;
pending_email: string | null;
email_verified_at: string | null;
password?: string;
remember_token?: string | null;

View File

@@ -80,6 +80,7 @@ export interface User {
id: string;
name: string;
email: string;
pending_email: string | null;
email_verified_at: string | null;
password?: string;
remember_token?: string | null;