Android CI / RC / Android · lint, tests, debug APK, release compile (push) Failing after 1m25s
DH V2 CI / API · typecheck, tests, build (push) Successful in 34s
DH V2 CI / WEB · typecheck, build (push) Successful in 20s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 9s
DH V2 CI / Docker / scripts contract (push) Successful in 1m16s
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { apiRequest } from './api';
|
|
import type { AdministrativeUser } from './api';
|
|
|
|
export interface AdministrativeUserProfile extends AdministrativeUser {
|
|
dni: string | null;
|
|
phone: string | null;
|
|
jobTitle: string | null;
|
|
employeeNumber: string | null;
|
|
}
|
|
|
|
export interface UserProfileInput {
|
|
username?: string;
|
|
email?: string | null;
|
|
dni?: string | null;
|
|
phone?: string | null;
|
|
jobTitle?: string | null;
|
|
employeeNumber?: string | null;
|
|
firstName?: string;
|
|
lastName?: string;
|
|
}
|
|
|
|
export interface CreateUserProfileInput extends UserProfileInput {
|
|
username: string;
|
|
email: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
password: string;
|
|
mustChangePassword: boolean;
|
|
roleIds: string[];
|
|
}
|
|
|
|
export function getUserProfile(id: string) {
|
|
return apiRequest<AdministrativeUserProfile>(`/users/${id}`);
|
|
}
|
|
|
|
export function createUserProfile(input: CreateUserProfileInput) {
|
|
return apiRequest<AdministrativeUserProfile>('/users', {
|
|
method: 'POST',
|
|
body: JSON.stringify(input),
|
|
});
|
|
}
|
|
|
|
export function updateUserProfile(id: string, input: UserProfileInput) {
|
|
return apiRequest<AdministrativeUserProfile>(`/users/${id}`, {
|
|
method: 'PATCH',
|
|
body: JSON.stringify(input),
|
|
});
|
|
}
|