296 lines
8.7 KiB
TypeScript
296 lines
8.7 KiB
TypeScript
import { api } from "./api";
|
|
import type { Nullable } from "./apiTypes.ts";
|
|
import type * as tokens from "./tokens.ts";
|
|
import type * as responses from "./responses.ts";
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/me; name=me; method=GET; response=users.User
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 43
|
|
export const me = async (): Promise<{
|
|
data: User;
|
|
error: Nullable<string>;
|
|
}> => {
|
|
return (await api.GET("/api/auth/me")) as {
|
|
data: User;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/password/update; name=updatePassword; method=PUT; request=users.UpdatePasswordRequest; response=responses.SimpleResponse
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 64
|
|
export const updatePassword = async (
|
|
data: UpdatePasswordRequest,
|
|
): Promise<{ data: responses.SimpleResponse; error: Nullable<string> }> => {
|
|
return (await api.PUT("/api/auth/password/update", data)) as {
|
|
data: responses.SimpleResponse;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/users; name=createUser; method=POST; request=users.UserCreateRequest; response=users.User
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 31
|
|
export const createUser = async (
|
|
data: UserCreateRequest,
|
|
): Promise<{ data: User; error: Nullable<string> }> => {
|
|
return (await api.POST("/api/users", data)) as {
|
|
data: User;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/users/update/details; name=updateUserDetails; method=PUT; request=users.UpdateUserDetailsRequest; response=users.User
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 37
|
|
export const updateUserDetails = async (
|
|
data: UpdateUserDetailsRequest,
|
|
): Promise<{ data: User; error: Nullable<string> }> => {
|
|
return (await api.PUT("/api/users/update/details", data)) as {
|
|
data: User;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/refresh; name=refresh; method=POST; request=users.RefreshRequest; response=tokens.TokenPair
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 49
|
|
export const refresh = async (
|
|
data: RefreshRequest,
|
|
): Promise<{ data: tokens.TokenPair; error: Nullable<string> }> => {
|
|
return (await api.POST("/api/auth/refresh", data)) as {
|
|
data: tokens.TokenPair;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/password/reset; name=resetPassword; method=POST; request=users.ResetPasswordRequest; response=responses.SimpleResponse
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 58
|
|
export const resetPassword = async (
|
|
data: ResetPasswordRequest,
|
|
): Promise<{ data: responses.SimpleResponse; error: Nullable<string> }> => {
|
|
return (await api.POST("/api/auth/password/reset", data)) as {
|
|
data: responses.SimpleResponse;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/register; name=register; method=POST; request=users.UserCreateRequest; response=users.User
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 52
|
|
export const register = async (
|
|
data: UserCreateRequest,
|
|
): Promise<{ data: User; error: Nullable<string> }> => {
|
|
return (await api.POST("/api/auth/register", data)) as {
|
|
data: User;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/users/:id; name=deleteUser; method=DELETE; response=responses.SimpleResponse
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 40
|
|
export const deleteUser = async (
|
|
id: string,
|
|
): Promise<{ data: responses.SimpleResponse; error: Nullable<string> }> => {
|
|
return (await api.DELETE(`/api/users/${id}`)) as {
|
|
data: responses.SimpleResponse;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/login; name=login; method=POST; request=users.LoginRequest; response=tokens.TokenPair
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 46
|
|
export const login = async (
|
|
data: LoginRequest,
|
|
): Promise<{ data: tokens.TokenPair; error: Nullable<string> }> => {
|
|
return (await api.POST("/api/auth/login", data)) as {
|
|
data: tokens.TokenPair;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/password/forgot; name=forgotPassword; method=POST; request=users.ForgotPasswordRequest; response=responses.SimpleResponse
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 55
|
|
export const forgotPassword = async (
|
|
data: ForgotPasswordRequest,
|
|
): Promise<{ data: responses.SimpleResponse; error: Nullable<string> }> => {
|
|
return (await api.POST("/api/auth/password/forgot", data)) as {
|
|
data: responses.SimpleResponse;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/auth/password/valid; name=validToken; method=POST; request=string; response=responses.SimpleResponse
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 61
|
|
export const validToken = async (
|
|
data: string,
|
|
): Promise<{ data: responses.SimpleResponse; error: Nullable<string> }> => {
|
|
return (await api.POST("/api/auth/password/valid", data)) as {
|
|
data: responses.SimpleResponse;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/users/:id; name=getUser; method=GET; response=users.User
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 28
|
|
export const getUser = async (
|
|
id: string,
|
|
): Promise<{ data: User; error: Nullable<string> }> => {
|
|
return (await api.GET(`/api/users/${id}`)) as {
|
|
data: User;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
// Typescript: TSEndpoint= path=/api/users/update; name=updateUser; method=PUT; request=users.UpdateUserRequest; response=users.User
|
|
|
|
// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/user/routes.go Line: 34
|
|
export const updateUser = async (
|
|
data: UpdateUserRequest,
|
|
): Promise<{ data: User; error: Nullable<string> }> => {
|
|
return (await api.PUT("/api/users/update", data)) as {
|
|
data: User;
|
|
error: Nullable<string>;
|
|
};
|
|
};
|
|
|
|
export interface UserDetails {
|
|
id: number;
|
|
userId: string;
|
|
title: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
address: string;
|
|
city: string;
|
|
zipCode: string;
|
|
country: string;
|
|
phone: string;
|
|
createdAt?: Date;
|
|
updatedAt?: Date;
|
|
}
|
|
|
|
export interface UpdateUserRequest {
|
|
id: string;
|
|
name: string;
|
|
email: string;
|
|
password: string;
|
|
permission: string;
|
|
status: UserStatus;
|
|
type: UserType;
|
|
}
|
|
|
|
export interface UpdateUserDetailsRequest {
|
|
id: number;
|
|
userId: string;
|
|
title: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
address: string;
|
|
city: string;
|
|
zipCode: string;
|
|
country: string;
|
|
phone: string;
|
|
}
|
|
|
|
export interface RefreshRequest {
|
|
refresh_token: string;
|
|
}
|
|
|
|
export interface UpdateUserPreferencesRequest {
|
|
id: number;
|
|
userId: string;
|
|
useIdle: boolean;
|
|
idleTimeout: number;
|
|
useIdlePassword: boolean;
|
|
idlePin: string;
|
|
useDirectLogin: boolean;
|
|
useQuadcodeLogin: boolean;
|
|
sendNoticesMail: boolean;
|
|
language: string;
|
|
}
|
|
|
|
export interface UserCreateRequest {
|
|
name: string;
|
|
email: string;
|
|
password: string;
|
|
permission: string;
|
|
status: UserStatus;
|
|
type: UserType;
|
|
avatar?: Nullable<string>;
|
|
details?: Nullable<UserDetails>;
|
|
preferences?: Nullable<UserPreferences>;
|
|
}
|
|
|
|
export interface UpdatePasswordRequest {
|
|
id: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface User {
|
|
id: string;
|
|
email: string;
|
|
name: string;
|
|
permission: string;
|
|
type: UserType;
|
|
status: UserStatus;
|
|
details: Nullable<UserDetails>;
|
|
preferences: Nullable<UserPreferences>;
|
|
avatar: Nullable<string>;
|
|
activatedAt: Nullable<Date>;
|
|
createdAt?: Date;
|
|
updatedAt?: Date;
|
|
}
|
|
|
|
export interface ForgotPasswordRequest {
|
|
email: string;
|
|
}
|
|
|
|
export interface UserPreferences {
|
|
id: number;
|
|
userId: string;
|
|
useIdle: boolean;
|
|
idleTimeout: number;
|
|
useIdlePassword: boolean;
|
|
idlePin: string;
|
|
useDirectLogin: boolean;
|
|
useQuadcodeLogin: boolean;
|
|
sendNoticesMail: boolean;
|
|
language: string;
|
|
createdAt?: Date;
|
|
updatedAt?: Date;
|
|
}
|
|
|
|
export interface LoginRequest {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface ResetPasswordRequest {
|
|
token: string;
|
|
password: string;
|
|
}
|
|
|
|
export type UserTypes = (typeof EnumUserTypes)[keyof typeof EnumUserTypes];
|
|
|
|
export type UserStatus = string;
|
|
|
|
export type UserType = string;
|
|
|
|
export const EnumUserStatus = {
|
|
UserStatusPending: "pending",
|
|
UserStatusActive: "active",
|
|
UserStatusDisabled: "disabled",
|
|
} as const;
|
|
|
|
export const EnumUserTypes = {
|
|
UserTypeInternal: "internal",
|
|
UserTypeExternal: "external",
|
|
UserTypeSurveyor: "surveyor",
|
|
} as const;
|