From 1ab1eed8d961e18a2a831abfa4effdbeb6b531ef Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 4 Nov 2024 04:15:48 +0000 Subject: [PATCH 1/4] chore: upgrade generated files --- apps/frontend/src/api.gen.ts | 1736 ++++++++++++++++++++++++++-- apps/frontend/src/routeTree.gen.ts | 8 +- 2 files changed, 1647 insertions(+), 97 deletions(-) diff --git a/apps/frontend/src/api.gen.ts b/apps/frontend/src/api.gen.ts index 2401f23..f918baa 100644 --- a/apps/frontend/src/api.gen.ts +++ b/apps/frontend/src/api.gen.ts @@ -60,6 +60,265 @@ export interface paths { patch?: never; trace?: never; }; + "/carers": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all carers */ + get: operations["CarersController_index"]; + put?: never; + /** Create a carer */ + post: operations["CarersController_create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/carers/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a carer by ID */ + get: operations["CarersController_get"]; + put?: never; + post?: never; + /** Delete a carer by ID */ + delete: operations["CarersController_delete"]; + options?: never; + head?: never; + /** Update a carer by ID */ + patch: operations["CarersController_update"]; + trace?: never; + }; + "/languages": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all languages */ + get: operations["LanguagesController_index"]; + put?: never; + /** Create a language */ + post: operations["LanguagesController_create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/languages/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a language by ID */ + get: operations["LanguagesController_get"]; + put?: never; + post?: never; + /** Delete a language by ID */ + delete: operations["LanguagesController_delete"]; + options?: never; + head?: never; + /** Update a language by ID */ + patch: operations["LanguagesController_update"]; + trace?: never; + }; + "/participants": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all participants */ + get: operations["ParticipantsController_index"]; + put?: never; + /** Create a participant */ + post: operations["ParticipantsController_create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/participants/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a participant by ID */ + get: operations["ParticipantsController_get"]; + put?: never; + post?: never; + /** Delete a participant by ID */ + delete: operations["ParticipantsController_delete"]; + options?: never; + head?: never; + /** Update a participant by ID */ + patch: operations["ParticipantsController_update"]; + trace?: never; + }; + "/entries": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all entries */ + get: operations["EntriesController_index"]; + put?: never; + /** Create a entry */ + post: operations["EntriesController_create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/entries/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a entry by ID */ + get: operations["EntriesController_get"]; + put?: never; + post?: never; + /** Delete a entry by ID */ + delete: operations["EntriesController_delete"]; + options?: never; + head?: never; + /** Update a entry by ID */ + patch: operations["EntriesController_update"]; + trace?: never; + }; + "/questionnaires": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all questionnairess */ + get: operations["QuestionnairesController_index"]; + put?: never; + /** Create a questionnaires */ + post: operations["QuestionnairesController_create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/questionnaires/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a questionnaires by ID */ + get: operations["QuestionnairesController_get"]; + put?: never; + post?: never; + /** Delete a questionnaires by ID */ + delete: operations["QuestionnairesController_delete"]; + options?: never; + head?: never; + /** Update a questionnaires by ID */ + patch: operations["QuestionnairesController_update"]; + trace?: never; + }; + "/entry-languages": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all entry languages */ + get: operations["EntryLanguagesController_index"]; + put?: never; + /** Create an entry language */ + post: operations["EntryLanguagesController_create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/entry-languages/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get an entry language by ID */ + get: operations["EntryLanguagesController_get"]; + put?: never; + post?: never; + /** Delete an entry language by ID */ + delete: operations["EntryLanguagesController_delete"]; + options?: never; + head?: never; + /** Update an entry language by ID */ + patch: operations["EntryLanguagesController_update"]; + trace?: never; + }; + "/studies": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all studies */ + get: operations["StudiesController_index"]; + put?: never; + /** Create a study */ + post: operations["StudiesController_create"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/studies/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a study by ID */ + get: operations["StudiesController_get"]; + put?: never; + post?: never; + /** Delete a study by ID */ + delete: operations["StudiesController_delete"]; + options?: never; + head?: never; + /** Update a study by ID */ + patch: operations["StudiesController_update"]; + trace?: never; + }; } export type webhooks = Record; export interface components { @@ -67,7 +326,7 @@ export interface components { UserCreationDto: { /** * @description The email of the user - * @example administrator@example.com + * @example admin@example.com */ email: string; /** @@ -90,7 +349,63 @@ export interface components { id: number; /** * @description The email of the user - * @example administrator@example.com + * @example admin@example.com + */ + email: string; + /** + * @description The role of the user + * @example ADMIN + * @enum {string} + */ + role?: "ASSISTANT" | "ADMIN"; + }; + ErrorResponseDto: { + /** @description Status code of the error */ + statusCode: number; + /** @description Descriptive message of the error */ + message: string; + /** @description Error name */ + error?: string; + }; + UserMutationDto: { + /** + * @description The email of the user + * @example admin@example.com + */ + email?: string; + /** + * @description The password of the user + * @example Quassel*1234 + */ + password?: string; + /** + * @description The role of the user + * @example ADMIN + * @enum {string} + */ + role?: "ASSISTANT" | "ADMIN"; + }; + SessionCreationDto: { + /** + * @description The email of the user + * @example admin@example.com + */ + email: string; + /** + * @description The password of the user + * @example Quassel*1234 + */ + password: string; + }; + SessionResponseDto: { + /** + * @description The id of the user + * @example 1 + */ + id: number; + /** + * @description The email of the user + * @example admin@example.com */ email: string; /** @@ -100,72 +415,1166 @@ export interface components { */ role?: "ASSISTANT" | "ADMIN"; }; - ErrorResponseDto: { - /** @description Status code of the error */ - statusCode: number; - /** @description Descriptive message of the error */ - message: string; - /** @description Error name */ - error?: string; + ParticipantDto: { + /** + * @description The id of the participant (child id) + * @example 1 + */ + id: number; + /** + * Format: date-time + * @description The birthday of the participant + * @example 2024-11-01T00:05:02.718Z + */ + birthday?: string; + questionnaires: number[]; + carers: number[]; + languages: number[]; + }; + CarerCreationDto: { + /** + * @description The name of the carer + * @example Grandmother + */ + name: string; + participant?: components["schemas"]["ParticipantDto"]; + }; + CarerResponseDto: { + /** + * @description The id of the carer + * @example 1 + */ + id: number; + /** + * @description The name of the carer + * @example Grandmother + */ + name: string; + participant?: components["schemas"]["ParticipantDto"]; + entries: number[]; + }; + CarerMutationDto: { + /** + * @description The name of the carer + * @example Grandmother + */ + name?: string; + participant?: components["schemas"]["ParticipantDto"]; + }; + LanguageCreationDto: { + /** + * @description The name of the language + * @example Deutsch + */ + name: string; + /** + * @description The IETF BCP 47 code of the language + * @example de-DE + */ + ietfBcp47?: string; + participant?: components["schemas"]["ParticipantDto"]; + }; + LanguageResponseDto: { + /** + * @description The id of the language + * @example 1 + */ + id: number; + /** + * @description The name of the language + * @example Deutsch + */ + name: string; + /** + * @description The IETF BCP 47 code of the language + * @example de-DE + */ + ietfBcp47?: string; + participant?: components["schemas"]["ParticipantDto"]; + entryLanguages: number[]; + }; + LanguageMutationDto: { + /** + * @description The name of the language + * @example Deutsch + */ + name?: string; + /** + * @description The IETF BCP 47 code of the language + * @example de-DE + */ + ietfBcp47?: string; + participant?: components["schemas"]["ParticipantDto"]; + }; + ParticipantCreationDto: { + /** + * @description The id of the participant (child id) + * @example 1 + */ + id: number; + /** + * Format: date-time + * @description The birthday of the participant + * @example 2024-11-01T00:05:02.718Z + */ + birthday?: string; + }; + ParticipantResponseDto: { + /** + * @description The id of the participant (child id) + * @example 1 + */ + id: number; + /** + * Format: date-time + * @description The birthday of the participant + * @example 2024-11-01T00:05:02.718Z + */ + birthday?: string; + questionnaires: number[]; + carers: number[]; + languages: number[]; + }; + ParticipantMutationDto: { + /** + * @description The id of the participant (child id) + * @example 1 + */ + id?: number; + /** + * Format: date-time + * @description The birthday of the participant + * @example 2024-11-01T00:05:02.718Z + */ + birthday?: string; + questionnaires?: number[]; + carers?: number[]; + languages?: number[]; + }; + StudyDto: { + /** + * @description The id of the study (child id) + * @example 1 + */ + id: number; + /** + * @description The title of the study + * @example Series 1 + */ + title: string; + questionnaires: number[]; + }; + QuestionnaireDto: { + /** + * @description The id of the questionnaire + * @example 1 + */ + id: number; + /** + * Format: date-time + * @description The starting date of the questionnaire + * @example 2024-11-01T07:00:00.000Z + */ + startedAt: string; + /** + * Format: date-time + * @description The ending date of the questionnaire + * @example 2024-11-01T08:00:00.00Z + */ + endedAt: string; + /** + * @description The title of the questionnaire + * @example First few months + */ + title: string; + /** + * @description The remark of the questionnaire + * @example We went on holidays for 2 weeks and only spoke Esperanto + */ + remark?: string; + study: components["schemas"]["StudyDto"]; + participant: components["schemas"]["ParticipantDto"]; + entries: number[]; + }; + CarerDto: { + /** + * @description The id of the carer + * @example 1 + */ + id: number; + /** + * @description The name of the carer + * @example Grandmother + */ + name: string; + participant?: components["schemas"]["ParticipantDto"]; + entries: number[]; + }; + EntryCreationDto: { + /** + * @description The starting date of the entry + * @example 2024-11-01T07:00:00.000Z + */ + startedAt: string; + /** + * @description The ending date of the entry + * @example 2024-11-01T08:00:00.00Z + */ + endedAt: string; + /** + * @description The weekday of the entry (Sunday is 0 like in JS) + * @example 1 + */ + weekday: number; + /** + * @description The weekly recurring of the entry + * @example 1 + */ + weeklyRecurring?: number; + questionnaire: components["schemas"]["QuestionnaireDto"]; + carer: components["schemas"]["CarerDto"]; + entryLanguages: number[]; + }; + EntryResponseDto: { + /** + * @description The id of the entry + * @example 1 + */ + id: number; + /** + * @description The starting date of the entry + * @example 2024-11-01T07:00:00.000Z + */ + startedAt: string; + /** + * @description The ending date of the entry + * @example 2024-11-01T08:00:00.00Z + */ + endedAt: string; + /** + * @description The weekday of the entry (Sunday is 0 like in JS) + * @example 1 + */ + weekday: number; + /** + * @description The weekly recurring of the entry + * @example 1 + */ + weeklyRecurring?: number; + questionnaire: components["schemas"]["QuestionnaireDto"]; + carer: components["schemas"]["CarerDto"]; + entryLanguages: number[]; + }; + EntryMutationDto: { + /** + * @description The starting date of the entry + * @example 2024-11-01T07:00:00.000Z + */ + startedAt?: string; + /** + * @description The ending date of the entry + * @example 2024-11-01T08:00:00.00Z + */ + endedAt?: string; + /** + * @description The weekday of the entry (Sunday is 0 like in JS) + * @example 1 + */ + weekday?: number; + /** + * @description The weekly recurring of the entry + * @example 1 + */ + weeklyRecurring?: number; + questionnaire?: components["schemas"]["QuestionnaireDto"]; + carer?: components["schemas"]["CarerDto"]; + entryLanguages?: number[]; + }; + QuestionnaireCreationDto: { + /** + * Format: date-time + * @description The starting date of the questionnaire + * @example 2024-11-01T07:00:00.000Z + */ + startedAt: string; + /** + * Format: date-time + * @description The ending date of the questionnaire + * @example 2024-11-01T08:00:00.00Z + */ + endedAt: string; + /** + * @description The title of the questionnaire + * @example First few months + */ + title: string; + /** + * @description The remark of the questionnaire + * @example We went on holidays for 2 weeks and only spoke Esperanto + */ + remark?: string; + study: components["schemas"]["StudyDto"]; + participant: components["schemas"]["ParticipantDto"]; + entries: number[]; + }; + QuestionnaireResponseDto: { + /** + * @description The id of the questionnaire + * @example 1 + */ + id: number; + /** + * Format: date-time + * @description The starting date of the questionnaire + * @example 2024-11-01T07:00:00.000Z + */ + startedAt: string; + /** + * Format: date-time + * @description The ending date of the questionnaire + * @example 2024-11-01T08:00:00.00Z + */ + endedAt: string; + /** + * @description The title of the questionnaire + * @example First few months + */ + title: string; + /** + * @description The remark of the questionnaire + * @example We went on holidays for 2 weeks and only spoke Esperanto + */ + remark?: string; + study: components["schemas"]["StudyDto"]; + participant: components["schemas"]["ParticipantDto"]; + entries: number[]; + }; + QuestionnaireMutationDto: { + /** + * Format: date-time + * @description The starting date of the questionnaire + * @example 2024-11-01T07:00:00.000Z + */ + startedAt?: string; + /** + * Format: date-time + * @description The ending date of the questionnaire + * @example 2024-11-01T08:00:00.00Z + */ + endedAt?: string; + /** + * @description The title of the questionnaire + * @example First few months + */ + title?: string; + /** + * @description The remark of the questionnaire + * @example We went on holidays for 2 weeks and only spoke Esperanto + */ + remark?: string; + study?: components["schemas"]["StudyDto"]; + participant?: components["schemas"]["ParticipantDto"]; + entries?: number[]; + }; + LanguageDto: { + /** + * @description The id of the language + * @example 1 + */ + id: number; + /** + * @description The name of the language + * @example Deutsch + */ + name: string; + /** + * @description The IETF BCP 47 code of the language + * @example de-DE + */ + ietfBcp47?: string; + participant?: components["schemas"]["ParticipantDto"]; + entryLanguages: number[]; + }; + EntryDto: { + /** + * @description The id of the entry + * @example 1 + */ + id: number; + /** + * @description The starting date of the entry + * @example 2024-11-01T07:00:00.000Z + */ + startedAt: string; + /** + * @description The ending date of the entry + * @example 2024-11-01T08:00:00.00Z + */ + endedAt: string; + /** + * @description The weekday of the entry (Sunday is 0 like in JS) + * @example 1 + */ + weekday: number; + /** + * @description The weekly recurring of the entry + * @example 1 + */ + weeklyRecurring?: number; + questionnaire: components["schemas"]["QuestionnaireDto"]; + carer: components["schemas"]["CarerDto"]; + entryLanguages: number[]; + }; + EntryLanguageCreationDto: { + /** + * @description The ratio in percent of the entry language + * @example 50 + */ + ratio: number; + language: components["schemas"]["LanguageDto"]; + entry: components["schemas"]["EntryDto"]; + }; + EntryLanguageResponseDto: { + /** + * @description The id of the entry language + * @example 1 + */ + id: number; + /** + * @description The ratio in percent of the entry language + * @example 50 + */ + ratio: number; + language: components["schemas"]["LanguageDto"]; + entry: components["schemas"]["EntryDto"]; + }; + EntryLanguageMutationDto: { + /** + * @description The ratio in percent of the entry language + * @example 50 + */ + ratio?: number; + language?: components["schemas"]["LanguageDto"]; + entry?: components["schemas"]["EntryDto"]; + }; + StudyCreationDto: { + /** + * @description The id of the study (child id) + * @example 1 + */ + id: number; + /** + * @description The title of the study + * @example Series 1 + */ + title: string; + questionnaires: number[]; + }; + StudyResponseDto: { + /** + * @description The id of the study (child id) + * @example 1 + */ + id: number; + /** + * @description The title of the study + * @example Series 1 + */ + title: string; + questionnaires: number[]; + }; + StudyMutationDto: { + /** + * @description The id of the study (child id) + * @example 1 + */ + id?: number; + /** + * @description The title of the study + * @example Series 1 + */ + title?: string; + questionnaires?: number[]; + }; + }; + responses: never; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + UsersController_index: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserResponseDto"][]; + }; + }; + }; + }; + UsersController_create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["UserCreationDto"]; + }; + }; + responses: { + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserResponseDto"]; + }; + }; + /** @description Unique email constraint violation */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + UsersController_get: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserResponseDto"]; + }; + }; + }; + }; + UsersController_delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + UsersController_update: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["UserMutationDto"]; + }; + }; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserResponseDto"]; + }; + }; + }; + }; + SessionController_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Current session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["SessionResponseDto"]; + }; + }; + /** @description Provided credentials are invalid */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + SessionController_create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["SessionCreationDto"]; + }; + }; + responses: { + /** @description Signed in */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["SessionResponseDto"]; + }; + }; + /** @description Provided credentials are invalid */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + SessionController_delete: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Signed out */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + CarersController_index: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CarerResponseDto"][]; + }; + }; + }; + }; + CarersController_create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CarerCreationDto"]; + }; + }; + responses: { + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CarerResponseDto"]; + }; + }; + /** @description Unique name constraint violation */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + CarersController_get: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CarerResponseDto"]; + }; + }; + }; + }; + CarersController_delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + CarersController_update: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CarerMutationDto"]; + }; + }; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CarerResponseDto"]; + }; + }; + }; + }; + LanguagesController_index: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["LanguageResponseDto"][]; + }; + }; + }; + }; + LanguagesController_create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["LanguageCreationDto"]; + }; + }; + responses: { + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["LanguageResponseDto"]; + }; + }; + /** @description Unique name constraint violation */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + LanguagesController_get: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["LanguageResponseDto"]; + }; + }; + }; + }; + LanguagesController_delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + LanguagesController_update: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["LanguageMutationDto"]; + }; + }; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["LanguageResponseDto"]; + }; + }; + }; + }; + ParticipantsController_index: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ParticipantResponseDto"][]; + }; + }; + }; + }; + ParticipantsController_create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["ParticipantCreationDto"]; + }; + }; + responses: { + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ParticipantResponseDto"]; + }; + }; + /** @description Unique id constraint violation */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + ParticipantsController_get: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ParticipantResponseDto"]; + }; + }; + }; + }; + ParticipantsController_delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + ParticipantsController_update: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["ParticipantMutationDto"]; + }; + }; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ParticipantResponseDto"]; + }; + }; + }; + }; + EntriesController_index: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EntryResponseDto"][]; + }; + }; + }; + }; + EntriesController_create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["EntryCreationDto"]; + }; + }; + responses: { + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EntryResponseDto"]; + }; + }; + /** @description Unique name constraint violation */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponseDto"]; + }; + }; + }; + }; + EntriesController_get: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EntryResponseDto"]; + }; + }; + }; + }; + EntriesController_delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; - UserMutationDto: { - /** - * @description The email of the user - * @example administrator@example.com - */ - email?: string; - /** - * @description The password of the user - * @example Quassel*1234 - */ - password?: string; - /** - * @description The role of the user - * @example ADMIN - * @enum {string} - */ - role?: "ASSISTANT" | "ADMIN"; + }; + EntriesController_update: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; }; - SessionCreationDto: { - /** - * @description The email of the user - * @example administrator@example.com - */ - email: string; - /** - * @description The password of the user - * @example Quassel*1234 - */ - password: string; + requestBody: { + content: { + "application/json": components["schemas"]["EntryMutationDto"]; + }; }; - SessionResponseDto: { - /** - * @description The id of the user - * @example 1 - */ - id: number; - /** - * @description The email of the user - * @example administrator@example.com - */ - email: string; - /** - * @description The role of the user - * @example ADMIN - * @enum {string} - */ - role?: "ASSISTANT" | "ADMIN"; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EntryResponseDto"]; + }; + }; }; }; - responses: never; - parameters: never; - requestBodies: never; - headers: never; - pathItems: never; -} -export type $defs = Record; -export interface operations { - UsersController_index: { + QuestionnairesController_index: { parameters: { query?: never; header?: never; @@ -179,12 +1588,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["UserResponseDto"][]; + "application/json": components["schemas"]["QuestionnaireResponseDto"][]; }; }; }; }; - UsersController_create: { + QuestionnairesController_create: { parameters: { query?: never; header?: never; @@ -193,7 +1602,7 @@ export interface operations { }; requestBody: { content: { - "application/json": components["schemas"]["UserCreationDto"]; + "application/json": components["schemas"]["QuestionnaireCreationDto"]; }; }; responses: { @@ -202,10 +1611,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["UserResponseDto"]; + "application/json": components["schemas"]["QuestionnaireResponseDto"]; }; }; - /** @description Unique email constraint violation */ + /** @description Unique name constraint violation */ 422: { headers: { [name: string]: unknown; @@ -216,7 +1625,7 @@ export interface operations { }; }; }; - UsersController_get: { + QuestionnairesController_get: { parameters: { query?: never; header?: never; @@ -232,12 +1641,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["UserResponseDto"]; + "application/json": components["schemas"]["QuestionnaireResponseDto"]; }; }; }; }; - UsersController_delete: { + QuestionnairesController_delete: { parameters: { query?: never; header?: never; @@ -256,7 +1665,7 @@ export interface operations { }; }; }; - UsersController_update: { + QuestionnairesController_update: { parameters: { query?: never; header?: never; @@ -267,7 +1676,7 @@ export interface operations { }; requestBody: { content: { - "application/json": components["schemas"]["UserMutationDto"]; + "application/json": components["schemas"]["QuestionnaireMutationDto"]; }; }; responses: { @@ -276,12 +1685,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["UserResponseDto"]; + "application/json": components["schemas"]["QuestionnaireResponseDto"]; }; }; }; }; - SessionController_get: { + EntryLanguagesController_index: { parameters: { query?: never; header?: never; @@ -290,17 +1699,39 @@ export interface operations { }; requestBody?: never; responses: { - /** @description Current session */ 200: { headers: { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["SessionResponseDto"]; + "application/json": components["schemas"]["EntryLanguageResponseDto"][]; }; }; - /** @description Provided credentials are invalid */ - 401: { + }; + }; + EntryLanguagesController_create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["EntryLanguageCreationDto"]; + }; + }; + responses: { + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EntryLanguageResponseDto"]; + }; + }; + /** @description Unique name constraint violation */ + 422: { headers: { [name: string]: unknown; }; @@ -310,7 +1741,91 @@ export interface operations { }; }; }; - SessionController_create: { + EntryLanguagesController_get: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EntryLanguageResponseDto"]; + }; + }; + }; + }; + EntryLanguagesController_delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + EntryLanguagesController_update: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["EntryLanguageMutationDto"]; + }; + }; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EntryLanguageResponseDto"]; + }; + }; + }; + }; + StudiesController_index: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["StudyResponseDto"][]; + }; + }; + }; + }; + StudiesController_create: { parameters: { query?: never; header?: never; @@ -319,21 +1834,20 @@ export interface operations { }; requestBody: { content: { - "application/json": components["schemas"]["SessionCreationDto"]; + "application/json": components["schemas"]["StudyCreationDto"]; }; }; responses: { - /** @description Signed in */ 201: { headers: { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["SessionResponseDto"]; + "application/json": components["schemas"]["StudyResponseDto"]; }; }; - /** @description Provided credentials are invalid */ - 401: { + /** @description Unique name constraint violation */ + 422: { headers: { [name: string]: unknown; }; @@ -343,29 +1857,67 @@ export interface operations { }; }; }; - SessionController_delete: { + StudiesController_get: { parameters: { query?: never; header?: never; - path?: never; + path: { + id: string; + }; cookie?: never; }; requestBody?: never; responses: { - /** @description Signed out */ - 204: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["StudyResponseDto"]; + }; + }; + }; + }; + StudiesController_delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { headers: { [name: string]: unknown; }; content?: never; }; - /** @description Unauthorized */ - 401: { + }; + }; + StudiesController_update: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["StudyMutationDto"]; + }; + }; + responses: { + 200: { headers: { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["ErrorResponseDto"]; + "application/json": components["schemas"]["StudyResponseDto"]; }; }; }; diff --git a/apps/frontend/src/routeTree.gen.ts b/apps/frontend/src/routeTree.gen.ts index 4749456..59422ce 100644 --- a/apps/frontend/src/routeTree.gen.ts +++ b/apps/frontend/src/routeTree.gen.ts @@ -1,12 +1,12 @@ -/* prettier-ignore-start */ - /* eslint-disable */ // @ts-nocheck // noinspection JSUnusedGlobalSymbols -// This file is auto-generated by TanStack Router +// This file was automatically generated by TanStack Router. +// You should NOT make any changes in this file as it will be overwritten. +// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. // Import Routes @@ -463,8 +463,6 @@ export const routeTree = rootRoute ._addFileChildren(rootRouteChildren) ._addFileTypes(); -/* prettier-ignore-end */ - /* ROUTE_MANIFEST_START { "routes": { From c789d86186fa4347f0d6c10b9487d562c3e992de Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 4 Nov 2024 04:41:25 +0000 Subject: [PATCH 2/4] feat: carers management ui --- apps/frontend/src/routeTree.gen.ts | 110 ++++++++++++++++-- .../routes/_auth/administration/carers.tsx | 16 ++- .../_auth/administration/carers/edit.$id.tsx | 64 ++++++++++ .../_auth/administration/carers/index.tsx | 55 +++++++++ .../_auth/administration/carers/new.tsx | 41 +++++++ .../_auth/administration/users/edit.$id.tsx | 6 +- .../routes/_auth/administration/users/new.tsx | 6 +- 7 files changed, 279 insertions(+), 19 deletions(-) create mode 100644 apps/frontend/src/routes/_auth/administration/carers/edit.$id.tsx create mode 100644 apps/frontend/src/routes/_auth/administration/carers/index.tsx create mode 100644 apps/frontend/src/routes/_auth/administration/carers/new.tsx diff --git a/apps/frontend/src/routeTree.gen.ts b/apps/frontend/src/routeTree.gen.ts index 59422ce..16c6547 100644 --- a/apps/frontend/src/routeTree.gen.ts +++ b/apps/frontend/src/routeTree.gen.ts @@ -26,8 +26,11 @@ import { Route as AuthAdministrationLanguagesImport } from "./routes/_auth/admin import { Route as AuthAdministrationExportImport } from "./routes/_auth/administration/export"; import { Route as AuthAdministrationCarersImport } from "./routes/_auth/administration/carers"; import { Route as AuthAdministrationUsersIndexImport } from "./routes/_auth/administration/users/index"; +import { Route as AuthAdministrationCarersIndexImport } from "./routes/_auth/administration/carers/index"; import { Route as AuthAdministrationUsersNewImport } from "./routes/_auth/administration/users/new"; +import { Route as AuthAdministrationCarersNewImport } from "./routes/_auth/administration/carers/new"; import { Route as AuthAdministrationUsersEditIdImport } from "./routes/_auth/administration/users/edit.$id"; +import { Route as AuthAdministrationCarersEditIdImport } from "./routes/_auth/administration/carers/edit.$id"; // Create/Update Routes @@ -124,6 +127,13 @@ const AuthAdministrationUsersIndexRoute = getParentRoute: () => AuthAdministrationUsersRoute, } as any); +const AuthAdministrationCarersIndexRoute = + AuthAdministrationCarersIndexImport.update({ + id: "/", + path: "/", + getParentRoute: () => AuthAdministrationCarersRoute, + } as any); + const AuthAdministrationUsersNewRoute = AuthAdministrationUsersNewImport.update( { id: "/new", @@ -132,6 +142,13 @@ const AuthAdministrationUsersNewRoute = AuthAdministrationUsersNewImport.update( } as any, ); +const AuthAdministrationCarersNewRoute = + AuthAdministrationCarersNewImport.update({ + id: "/new", + path: "/new", + getParentRoute: () => AuthAdministrationCarersRoute, + } as any); + const AuthAdministrationUsersEditIdRoute = AuthAdministrationUsersEditIdImport.update({ id: "/edit/$id", @@ -139,6 +156,13 @@ const AuthAdministrationUsersEditIdRoute = getParentRoute: () => AuthAdministrationUsersRoute, } as any); +const AuthAdministrationCarersEditIdRoute = + AuthAdministrationCarersEditIdImport.update({ + id: "/edit/$id", + path: "/edit/$id", + getParentRoute: () => AuthAdministrationCarersRoute, + } as any); + // Populate the FileRoutesByPath interface declare module "@tanstack/react-router" { @@ -241,6 +265,13 @@ declare module "@tanstack/react-router" { preLoaderRoute: typeof AuthQuestionnaireIndexImport; parentRoute: typeof AuthQuestionnaireImport; }; + "/_auth/administration/carers/new": { + id: "/_auth/administration/carers/new"; + path: "/new"; + fullPath: "/administration/carers/new"; + preLoaderRoute: typeof AuthAdministrationCarersNewImport; + parentRoute: typeof AuthAdministrationCarersImport; + }; "/_auth/administration/users/new": { id: "/_auth/administration/users/new"; path: "/new"; @@ -248,6 +279,13 @@ declare module "@tanstack/react-router" { preLoaderRoute: typeof AuthAdministrationUsersNewImport; parentRoute: typeof AuthAdministrationUsersImport; }; + "/_auth/administration/carers/": { + id: "/_auth/administration/carers/"; + path: "/"; + fullPath: "/administration/carers/"; + preLoaderRoute: typeof AuthAdministrationCarersIndexImport; + parentRoute: typeof AuthAdministrationCarersImport; + }; "/_auth/administration/users/": { id: "/_auth/administration/users/"; path: "/"; @@ -255,6 +293,13 @@ declare module "@tanstack/react-router" { preLoaderRoute: typeof AuthAdministrationUsersIndexImport; parentRoute: typeof AuthAdministrationUsersImport; }; + "/_auth/administration/carers/edit/$id": { + id: "/_auth/administration/carers/edit/$id"; + path: "/edit/$id"; + fullPath: "/administration/carers/edit/$id"; + preLoaderRoute: typeof AuthAdministrationCarersEditIdImport; + parentRoute: typeof AuthAdministrationCarersImport; + }; "/_auth/administration/users/edit/$id": { id: "/_auth/administration/users/edit/$id"; path: "/edit/$id"; @@ -267,6 +312,24 @@ declare module "@tanstack/react-router" { // Create and export the route tree +interface AuthAdministrationCarersRouteChildren { + AuthAdministrationCarersNewRoute: typeof AuthAdministrationCarersNewRoute; + AuthAdministrationCarersIndexRoute: typeof AuthAdministrationCarersIndexRoute; + AuthAdministrationCarersEditIdRoute: typeof AuthAdministrationCarersEditIdRoute; +} + +const AuthAdministrationCarersRouteChildren: AuthAdministrationCarersRouteChildren = + { + AuthAdministrationCarersNewRoute: AuthAdministrationCarersNewRoute, + AuthAdministrationCarersIndexRoute: AuthAdministrationCarersIndexRoute, + AuthAdministrationCarersEditIdRoute: AuthAdministrationCarersEditIdRoute, + }; + +const AuthAdministrationCarersRouteWithChildren = + AuthAdministrationCarersRoute._addFileChildren( + AuthAdministrationCarersRouteChildren, + ); + interface AuthAdministrationUsersRouteChildren { AuthAdministrationUsersNewRoute: typeof AuthAdministrationUsersNewRoute; AuthAdministrationUsersIndexRoute: typeof AuthAdministrationUsersIndexRoute; @@ -286,7 +349,7 @@ const AuthAdministrationUsersRouteWithChildren = ); interface AuthAdministrationRouteChildren { - AuthAdministrationCarersRoute: typeof AuthAdministrationCarersRoute; + AuthAdministrationCarersRoute: typeof AuthAdministrationCarersRouteWithChildren; AuthAdministrationExportRoute: typeof AuthAdministrationExportRoute; AuthAdministrationLanguagesRoute: typeof AuthAdministrationLanguagesRoute; AuthAdministrationParticipantsRoute: typeof AuthAdministrationParticipantsRoute; @@ -297,7 +360,7 @@ interface AuthAdministrationRouteChildren { } const AuthAdministrationRouteChildren: AuthAdministrationRouteChildren = { - AuthAdministrationCarersRoute: AuthAdministrationCarersRoute, + AuthAdministrationCarersRoute: AuthAdministrationCarersRouteWithChildren, AuthAdministrationExportRoute: AuthAdministrationExportRoute, AuthAdministrationLanguagesRoute: AuthAdministrationLanguagesRoute, AuthAdministrationParticipantsRoute: AuthAdministrationParticipantsRoute, @@ -341,7 +404,7 @@ export interface FileRoutesByFullPath { "/administration": typeof AuthAdministrationRouteWithChildren; "/questionnaire": typeof AuthQuestionnaireRouteWithChildren; "/": typeof AuthIndexRoute; - "/administration/carers": typeof AuthAdministrationCarersRoute; + "/administration/carers": typeof AuthAdministrationCarersRouteWithChildren; "/administration/export": typeof AuthAdministrationExportRoute; "/administration/languages": typeof AuthAdministrationLanguagesRoute; "/administration/participants": typeof AuthAdministrationParticipantsRoute; @@ -350,15 +413,17 @@ export interface FileRoutesByFullPath { "/administration/users": typeof AuthAdministrationUsersRouteWithChildren; "/administration/": typeof AuthAdministrationIndexRoute; "/questionnaire/": typeof AuthQuestionnaireIndexRoute; + "/administration/carers/new": typeof AuthAdministrationCarersNewRoute; "/administration/users/new": typeof AuthAdministrationUsersNewRoute; + "/administration/carers/": typeof AuthAdministrationCarersIndexRoute; "/administration/users/": typeof AuthAdministrationUsersIndexRoute; + "/administration/carers/edit/$id": typeof AuthAdministrationCarersEditIdRoute; "/administration/users/edit/$id": typeof AuthAdministrationUsersEditIdRoute; } export interface FileRoutesByTo { "/session": typeof SessionRoute; "/": typeof AuthIndexRoute; - "/administration/carers": typeof AuthAdministrationCarersRoute; "/administration/export": typeof AuthAdministrationExportRoute; "/administration/languages": typeof AuthAdministrationLanguagesRoute; "/administration/participants": typeof AuthAdministrationParticipantsRoute; @@ -366,8 +431,11 @@ export interface FileRoutesByTo { "/administration/studies": typeof AuthAdministrationStudiesRoute; "/administration": typeof AuthAdministrationIndexRoute; "/questionnaire": typeof AuthQuestionnaireIndexRoute; + "/administration/carers/new": typeof AuthAdministrationCarersNewRoute; "/administration/users/new": typeof AuthAdministrationUsersNewRoute; + "/administration/carers": typeof AuthAdministrationCarersIndexRoute; "/administration/users": typeof AuthAdministrationUsersIndexRoute; + "/administration/carers/edit/$id": typeof AuthAdministrationCarersEditIdRoute; "/administration/users/edit/$id": typeof AuthAdministrationUsersEditIdRoute; } @@ -378,7 +446,7 @@ export interface FileRoutesById { "/_auth/administration": typeof AuthAdministrationRouteWithChildren; "/_auth/questionnaire": typeof AuthQuestionnaireRouteWithChildren; "/_auth/": typeof AuthIndexRoute; - "/_auth/administration/carers": typeof AuthAdministrationCarersRoute; + "/_auth/administration/carers": typeof AuthAdministrationCarersRouteWithChildren; "/_auth/administration/export": typeof AuthAdministrationExportRoute; "/_auth/administration/languages": typeof AuthAdministrationLanguagesRoute; "/_auth/administration/participants": typeof AuthAdministrationParticipantsRoute; @@ -387,8 +455,11 @@ export interface FileRoutesById { "/_auth/administration/users": typeof AuthAdministrationUsersRouteWithChildren; "/_auth/administration/": typeof AuthAdministrationIndexRoute; "/_auth/questionnaire/": typeof AuthQuestionnaireIndexRoute; + "/_auth/administration/carers/new": typeof AuthAdministrationCarersNewRoute; "/_auth/administration/users/new": typeof AuthAdministrationUsersNewRoute; + "/_auth/administration/carers/": typeof AuthAdministrationCarersIndexRoute; "/_auth/administration/users/": typeof AuthAdministrationUsersIndexRoute; + "/_auth/administration/carers/edit/$id": typeof AuthAdministrationCarersEditIdRoute; "/_auth/administration/users/edit/$id": typeof AuthAdministrationUsersEditIdRoute; } @@ -409,14 +480,16 @@ export interface FileRouteTypes { | "/administration/users" | "/administration/" | "/questionnaire/" + | "/administration/carers/new" | "/administration/users/new" + | "/administration/carers/" | "/administration/users/" + | "/administration/carers/edit/$id" | "/administration/users/edit/$id"; fileRoutesByTo: FileRoutesByTo; to: | "/session" | "/" - | "/administration/carers" | "/administration/export" | "/administration/languages" | "/administration/participants" @@ -424,8 +497,11 @@ export interface FileRouteTypes { | "/administration/studies" | "/administration" | "/questionnaire" + | "/administration/carers/new" | "/administration/users/new" + | "/administration/carers" | "/administration/users" + | "/administration/carers/edit/$id" | "/administration/users/edit/$id"; id: | "__root__" @@ -443,8 +519,11 @@ export interface FileRouteTypes { | "/_auth/administration/users" | "/_auth/administration/" | "/_auth/questionnaire/" + | "/_auth/administration/carers/new" | "/_auth/administration/users/new" + | "/_auth/administration/carers/" | "/_auth/administration/users/" + | "/_auth/administration/carers/edit/$id" | "/_auth/administration/users/edit/$id"; fileRoutesById: FileRoutesById; } @@ -511,7 +590,12 @@ export const routeTree = rootRoute }, "/_auth/administration/carers": { "filePath": "_auth/administration/carers.tsx", - "parent": "/_auth/administration" + "parent": "/_auth/administration", + "children": [ + "/_auth/administration/carers/new", + "/_auth/administration/carers/", + "/_auth/administration/carers/edit/$id" + ] }, "/_auth/administration/export": { "filePath": "_auth/administration/export.tsx", @@ -550,14 +634,26 @@ export const routeTree = rootRoute "filePath": "_auth/questionnaire/index.tsx", "parent": "/_auth/questionnaire" }, + "/_auth/administration/carers/new": { + "filePath": "_auth/administration/carers/new.tsx", + "parent": "/_auth/administration/carers" + }, "/_auth/administration/users/new": { "filePath": "_auth/administration/users/new.tsx", "parent": "/_auth/administration/users" }, + "/_auth/administration/carers/": { + "filePath": "_auth/administration/carers/index.tsx", + "parent": "/_auth/administration/carers" + }, "/_auth/administration/users/": { "filePath": "_auth/administration/users/index.tsx", "parent": "/_auth/administration/users" }, + "/_auth/administration/carers/edit/$id": { + "filePath": "_auth/administration/carers/edit.$id.tsx", + "parent": "/_auth/administration/carers" + }, "/_auth/administration/users/edit/$id": { "filePath": "_auth/administration/users/edit.$id.tsx", "parent": "/_auth/administration/users" diff --git a/apps/frontend/src/routes/_auth/administration/carers.tsx b/apps/frontend/src/routes/_auth/administration/carers.tsx index 75fc015..8bddace 100644 --- a/apps/frontend/src/routes/_auth/administration/carers.tsx +++ b/apps/frontend/src/routes/_auth/administration/carers.tsx @@ -1,5 +1,17 @@ -import { createFileRoute } from "@tanstack/react-router"; +import { Paper, Title } from "@quassel/ui"; +import { createFileRoute, Outlet } from "@tanstack/react-router"; + +function AdministrationCarers() { + return ( + <> + Carers + + + + + ); +} export const Route = createFileRoute("/_auth/administration/carers")({ - component: () =>
Hello /_auth/administration/carers!
, + component: AdministrationCarers, }); diff --git a/apps/frontend/src/routes/_auth/administration/carers/edit.$id.tsx b/apps/frontend/src/routes/_auth/administration/carers/edit.$id.tsx new file mode 100644 index 0000000..371aa27 --- /dev/null +++ b/apps/frontend/src/routes/_auth/administration/carers/edit.$id.tsx @@ -0,0 +1,64 @@ +import { createFileRoute, useNavigate } from "@tanstack/react-router"; +import { components } from "../../../../api.gen"; +import { $api } from "../../../../stores/api"; +import { useForm } from "@mantine/form"; +import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query"; +import { Button, TextInput } from "@quassel/ui"; +import { useEffect } from "react"; + +type FormValues = components["schemas"]["CarerMutationDto"]; + +function AdministrationUsersEdit() { + const p = Route.useParams(); + const q = useQueryClient(); + const carer = useSuspenseQuery($api.queryOptions("get", "/carers/{id}", { params: { path: { id: p.id } } })); + const n = useNavigate(); + const editCarerMutation = $api.useMutation("patch", "/carers/{id}", { + onSuccess: () => { + q.invalidateQueries( + $api.queryOptions("get", "/carers/{id}", { + params: { path: { id: p.id } }, + }) + ); + n({ to: "/administration/carers" }); + }, + }); + const f = useForm({ + initialValues: { + name: "", + }, + }); + const handleSubmit = (values: FormValues) => { + editCarerMutation.mutate({ + body: { ...values }, + params: { path: { id: p.id } }, + }); + }; + + useEffect(() => { + f.setValues(carer.data ?? {}); + f.resetDirty(); + }, [carer.isSuccess, carer.data]); + + return ( + <> +
+ + + + + + ); +} + +export const Route = createFileRoute("/_auth/administration/carers/edit/$id")({ + loader: ({ params, context: { queryClient } }) => + queryClient.ensureQueryData( + $api.queryOptions("get", "/carers/{id}", { + params: { path: { id: params.id } }, + }) + ), + component: AdministrationUsersEdit, +}); diff --git a/apps/frontend/src/routes/_auth/administration/carers/index.tsx b/apps/frontend/src/routes/_auth/administration/carers/index.tsx new file mode 100644 index 0000000..71c95af --- /dev/null +++ b/apps/frontend/src/routes/_auth/administration/carers/index.tsx @@ -0,0 +1,55 @@ +import { createFileRoute, Link } from "@tanstack/react-router"; +import { $api } from "../../../../stores/api"; +import { Button, Table } from "@quassel/ui"; +import { useSuspenseQuery } from "@tanstack/react-query"; + +function AdministrationCarerIndex() { + const carers = useSuspenseQuery($api.queryOptions("get", "/carers")); + const deleteUserMutation = $api.useMutation("delete", "/carers/{id}", { + onSuccess: () => carers.refetch(), + }); + + return ( + <> + + + + + Id + Name + + + + {carers.data?.map((c) => ( + + {c.id} + {c.name} + + + + + + ))} + +
+ + ); +} + +export const Route = createFileRoute("/_auth/administration/carers/")({ + loader: ({ context: { queryClient } }) => queryClient.ensureQueryData($api.queryOptions("get", "/carers")), + component: () => , +}); diff --git a/apps/frontend/src/routes/_auth/administration/carers/new.tsx b/apps/frontend/src/routes/_auth/administration/carers/new.tsx new file mode 100644 index 0000000..bab6381 --- /dev/null +++ b/apps/frontend/src/routes/_auth/administration/carers/new.tsx @@ -0,0 +1,41 @@ +import { useForm } from "@mantine/form"; +import { createFileRoute, useNavigate } from "@tanstack/react-router"; +import { Button, TextInput } from "@quassel/ui"; +import { $api } from "../../../../stores/api"; +import { components } from "../../../../api.gen"; + +type FormValues = components["schemas"]["CarerCreationDto"]; + +function AdministrationCarersNew() { + const n = useNavigate(); + const createCarerMutation = $api.useMutation("post", "/carers", { + onSuccess: () => { + n({ to: "/administration/carers" }); + }, + }); + const f = useForm({ + mode: "uncontrolled", + initialValues: { + name: "", + }, + }); + const handleSubmit = (values: FormValues) => { + createCarerMutation.mutate({ body: values }); + }; + + return ( + <> +
+ + + + + + ); +} + +export const Route = createFileRoute("/_auth/administration/carers/new")({ + component: AdministrationCarersNew, +}); diff --git a/apps/frontend/src/routes/_auth/administration/users/edit.$id.tsx b/apps/frontend/src/routes/_auth/administration/users/edit.$id.tsx index dc13db7..810db2a 100644 --- a/apps/frontend/src/routes/_auth/administration/users/edit.$id.tsx +++ b/apps/frontend/src/routes/_auth/administration/users/edit.$id.tsx @@ -6,11 +6,7 @@ import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query"; import { Button, PasswordInput, Select, TextInput } from "@quassel/ui"; import { useEffect } from "react"; -type FormValues = { - email: string; - password: string; - role?: components["schemas"]["UserCreationDto"]["role"]; -}; +type FormValues = components["schemas"]["UserMutationDto"]; function AdministrationUsersEdit() { const p = Route.useParams(); diff --git a/apps/frontend/src/routes/_auth/administration/users/new.tsx b/apps/frontend/src/routes/_auth/administration/users/new.tsx index e488a9f..5c53d93 100644 --- a/apps/frontend/src/routes/_auth/administration/users/new.tsx +++ b/apps/frontend/src/routes/_auth/administration/users/new.tsx @@ -4,11 +4,7 @@ import { components, userCreationDtoRoleValues } from "../../../../api.gen"; import { Button, PasswordInput, Select, TextInput } from "@quassel/ui"; import { $api } from "../../../../stores/api"; -type FormValues = { - email: string; - password: string; - role?: components["schemas"]["UserCreationDto"]["role"]; -}; +type FormValues = components["schemas"]["UserCreationDto"]; function AdministrationUsersNew() { const n = useNavigate(); From 16c35f204bbc440e783915bc67ce10436a385467 Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 4 Nov 2024 04:55:52 +0000 Subject: [PATCH 3/4] feat: languages management ui --- apps/frontend/src/routeTree.gen.ts | 113 ++++++++++++++++-- .../_auth/administration/carers/index.tsx | 4 +- .../routes/_auth/administration/languages.tsx | 16 ++- .../administration/languages/edit.$id.tsx | 70 +++++++++++ .../_auth/administration/languages/index.tsx | 57 +++++++++ .../_auth/administration/languages/new.tsx | 43 +++++++ .../_auth/administration/users/index.tsx | 2 +- 7 files changed, 293 insertions(+), 12 deletions(-) create mode 100644 apps/frontend/src/routes/_auth/administration/languages/edit.$id.tsx create mode 100644 apps/frontend/src/routes/_auth/administration/languages/index.tsx create mode 100644 apps/frontend/src/routes/_auth/administration/languages/new.tsx diff --git a/apps/frontend/src/routeTree.gen.ts b/apps/frontend/src/routeTree.gen.ts index 16c6547..c6a22d2 100644 --- a/apps/frontend/src/routeTree.gen.ts +++ b/apps/frontend/src/routeTree.gen.ts @@ -26,10 +26,13 @@ import { Route as AuthAdministrationLanguagesImport } from "./routes/_auth/admin import { Route as AuthAdministrationExportImport } from "./routes/_auth/administration/export"; import { Route as AuthAdministrationCarersImport } from "./routes/_auth/administration/carers"; import { Route as AuthAdministrationUsersIndexImport } from "./routes/_auth/administration/users/index"; +import { Route as AuthAdministrationLanguagesIndexImport } from "./routes/_auth/administration/languages/index"; import { Route as AuthAdministrationCarersIndexImport } from "./routes/_auth/administration/carers/index"; import { Route as AuthAdministrationUsersNewImport } from "./routes/_auth/administration/users/new"; +import { Route as AuthAdministrationLanguagesNewImport } from "./routes/_auth/administration/languages/new"; import { Route as AuthAdministrationCarersNewImport } from "./routes/_auth/administration/carers/new"; import { Route as AuthAdministrationUsersEditIdImport } from "./routes/_auth/administration/users/edit.$id"; +import { Route as AuthAdministrationLanguagesEditIdImport } from "./routes/_auth/administration/languages/edit.$id"; import { Route as AuthAdministrationCarersEditIdImport } from "./routes/_auth/administration/carers/edit.$id"; // Create/Update Routes @@ -127,6 +130,13 @@ const AuthAdministrationUsersIndexRoute = getParentRoute: () => AuthAdministrationUsersRoute, } as any); +const AuthAdministrationLanguagesIndexRoute = + AuthAdministrationLanguagesIndexImport.update({ + id: "/", + path: "/", + getParentRoute: () => AuthAdministrationLanguagesRoute, + } as any); + const AuthAdministrationCarersIndexRoute = AuthAdministrationCarersIndexImport.update({ id: "/", @@ -142,6 +152,13 @@ const AuthAdministrationUsersNewRoute = AuthAdministrationUsersNewImport.update( } as any, ); +const AuthAdministrationLanguagesNewRoute = + AuthAdministrationLanguagesNewImport.update({ + id: "/new", + path: "/new", + getParentRoute: () => AuthAdministrationLanguagesRoute, + } as any); + const AuthAdministrationCarersNewRoute = AuthAdministrationCarersNewImport.update({ id: "/new", @@ -156,6 +173,13 @@ const AuthAdministrationUsersEditIdRoute = getParentRoute: () => AuthAdministrationUsersRoute, } as any); +const AuthAdministrationLanguagesEditIdRoute = + AuthAdministrationLanguagesEditIdImport.update({ + id: "/edit/$id", + path: "/edit/$id", + getParentRoute: () => AuthAdministrationLanguagesRoute, + } as any); + const AuthAdministrationCarersEditIdRoute = AuthAdministrationCarersEditIdImport.update({ id: "/edit/$id", @@ -272,6 +296,13 @@ declare module "@tanstack/react-router" { preLoaderRoute: typeof AuthAdministrationCarersNewImport; parentRoute: typeof AuthAdministrationCarersImport; }; + "/_auth/administration/languages/new": { + id: "/_auth/administration/languages/new"; + path: "/new"; + fullPath: "/administration/languages/new"; + preLoaderRoute: typeof AuthAdministrationLanguagesNewImport; + parentRoute: typeof AuthAdministrationLanguagesImport; + }; "/_auth/administration/users/new": { id: "/_auth/administration/users/new"; path: "/new"; @@ -286,6 +317,13 @@ declare module "@tanstack/react-router" { preLoaderRoute: typeof AuthAdministrationCarersIndexImport; parentRoute: typeof AuthAdministrationCarersImport; }; + "/_auth/administration/languages/": { + id: "/_auth/administration/languages/"; + path: "/"; + fullPath: "/administration/languages/"; + preLoaderRoute: typeof AuthAdministrationLanguagesIndexImport; + parentRoute: typeof AuthAdministrationLanguagesImport; + }; "/_auth/administration/users/": { id: "/_auth/administration/users/"; path: "/"; @@ -300,6 +338,13 @@ declare module "@tanstack/react-router" { preLoaderRoute: typeof AuthAdministrationCarersEditIdImport; parentRoute: typeof AuthAdministrationCarersImport; }; + "/_auth/administration/languages/edit/$id": { + id: "/_auth/administration/languages/edit/$id"; + path: "/edit/$id"; + fullPath: "/administration/languages/edit/$id"; + preLoaderRoute: typeof AuthAdministrationLanguagesEditIdImport; + parentRoute: typeof AuthAdministrationLanguagesImport; + }; "/_auth/administration/users/edit/$id": { id: "/_auth/administration/users/edit/$id"; path: "/edit/$id"; @@ -330,6 +375,26 @@ const AuthAdministrationCarersRouteWithChildren = AuthAdministrationCarersRouteChildren, ); +interface AuthAdministrationLanguagesRouteChildren { + AuthAdministrationLanguagesNewRoute: typeof AuthAdministrationLanguagesNewRoute; + AuthAdministrationLanguagesIndexRoute: typeof AuthAdministrationLanguagesIndexRoute; + AuthAdministrationLanguagesEditIdRoute: typeof AuthAdministrationLanguagesEditIdRoute; +} + +const AuthAdministrationLanguagesRouteChildren: AuthAdministrationLanguagesRouteChildren = + { + AuthAdministrationLanguagesNewRoute: AuthAdministrationLanguagesNewRoute, + AuthAdministrationLanguagesIndexRoute: + AuthAdministrationLanguagesIndexRoute, + AuthAdministrationLanguagesEditIdRoute: + AuthAdministrationLanguagesEditIdRoute, + }; + +const AuthAdministrationLanguagesRouteWithChildren = + AuthAdministrationLanguagesRoute._addFileChildren( + AuthAdministrationLanguagesRouteChildren, + ); + interface AuthAdministrationUsersRouteChildren { AuthAdministrationUsersNewRoute: typeof AuthAdministrationUsersNewRoute; AuthAdministrationUsersIndexRoute: typeof AuthAdministrationUsersIndexRoute; @@ -351,7 +416,7 @@ const AuthAdministrationUsersRouteWithChildren = interface AuthAdministrationRouteChildren { AuthAdministrationCarersRoute: typeof AuthAdministrationCarersRouteWithChildren; AuthAdministrationExportRoute: typeof AuthAdministrationExportRoute; - AuthAdministrationLanguagesRoute: typeof AuthAdministrationLanguagesRoute; + AuthAdministrationLanguagesRoute: typeof AuthAdministrationLanguagesRouteWithChildren; AuthAdministrationParticipantsRoute: typeof AuthAdministrationParticipantsRoute; AuthAdministrationQuestionnairesRoute: typeof AuthAdministrationQuestionnairesRoute; AuthAdministrationStudiesRoute: typeof AuthAdministrationStudiesRoute; @@ -362,7 +427,8 @@ interface AuthAdministrationRouteChildren { const AuthAdministrationRouteChildren: AuthAdministrationRouteChildren = { AuthAdministrationCarersRoute: AuthAdministrationCarersRouteWithChildren, AuthAdministrationExportRoute: AuthAdministrationExportRoute, - AuthAdministrationLanguagesRoute: AuthAdministrationLanguagesRoute, + AuthAdministrationLanguagesRoute: + AuthAdministrationLanguagesRouteWithChildren, AuthAdministrationParticipantsRoute: AuthAdministrationParticipantsRoute, AuthAdministrationQuestionnairesRoute: AuthAdministrationQuestionnairesRoute, AuthAdministrationStudiesRoute: AuthAdministrationStudiesRoute, @@ -406,7 +472,7 @@ export interface FileRoutesByFullPath { "/": typeof AuthIndexRoute; "/administration/carers": typeof AuthAdministrationCarersRouteWithChildren; "/administration/export": typeof AuthAdministrationExportRoute; - "/administration/languages": typeof AuthAdministrationLanguagesRoute; + "/administration/languages": typeof AuthAdministrationLanguagesRouteWithChildren; "/administration/participants": typeof AuthAdministrationParticipantsRoute; "/administration/questionnaires": typeof AuthAdministrationQuestionnairesRoute; "/administration/studies": typeof AuthAdministrationStudiesRoute; @@ -414,10 +480,13 @@ export interface FileRoutesByFullPath { "/administration/": typeof AuthAdministrationIndexRoute; "/questionnaire/": typeof AuthQuestionnaireIndexRoute; "/administration/carers/new": typeof AuthAdministrationCarersNewRoute; + "/administration/languages/new": typeof AuthAdministrationLanguagesNewRoute; "/administration/users/new": typeof AuthAdministrationUsersNewRoute; "/administration/carers/": typeof AuthAdministrationCarersIndexRoute; + "/administration/languages/": typeof AuthAdministrationLanguagesIndexRoute; "/administration/users/": typeof AuthAdministrationUsersIndexRoute; "/administration/carers/edit/$id": typeof AuthAdministrationCarersEditIdRoute; + "/administration/languages/edit/$id": typeof AuthAdministrationLanguagesEditIdRoute; "/administration/users/edit/$id": typeof AuthAdministrationUsersEditIdRoute; } @@ -425,17 +494,19 @@ export interface FileRoutesByTo { "/session": typeof SessionRoute; "/": typeof AuthIndexRoute; "/administration/export": typeof AuthAdministrationExportRoute; - "/administration/languages": typeof AuthAdministrationLanguagesRoute; "/administration/participants": typeof AuthAdministrationParticipantsRoute; "/administration/questionnaires": typeof AuthAdministrationQuestionnairesRoute; "/administration/studies": typeof AuthAdministrationStudiesRoute; "/administration": typeof AuthAdministrationIndexRoute; "/questionnaire": typeof AuthQuestionnaireIndexRoute; "/administration/carers/new": typeof AuthAdministrationCarersNewRoute; + "/administration/languages/new": typeof AuthAdministrationLanguagesNewRoute; "/administration/users/new": typeof AuthAdministrationUsersNewRoute; "/administration/carers": typeof AuthAdministrationCarersIndexRoute; + "/administration/languages": typeof AuthAdministrationLanguagesIndexRoute; "/administration/users": typeof AuthAdministrationUsersIndexRoute; "/administration/carers/edit/$id": typeof AuthAdministrationCarersEditIdRoute; + "/administration/languages/edit/$id": typeof AuthAdministrationLanguagesEditIdRoute; "/administration/users/edit/$id": typeof AuthAdministrationUsersEditIdRoute; } @@ -448,7 +519,7 @@ export interface FileRoutesById { "/_auth/": typeof AuthIndexRoute; "/_auth/administration/carers": typeof AuthAdministrationCarersRouteWithChildren; "/_auth/administration/export": typeof AuthAdministrationExportRoute; - "/_auth/administration/languages": typeof AuthAdministrationLanguagesRoute; + "/_auth/administration/languages": typeof AuthAdministrationLanguagesRouteWithChildren; "/_auth/administration/participants": typeof AuthAdministrationParticipantsRoute; "/_auth/administration/questionnaires": typeof AuthAdministrationQuestionnairesRoute; "/_auth/administration/studies": typeof AuthAdministrationStudiesRoute; @@ -456,10 +527,13 @@ export interface FileRoutesById { "/_auth/administration/": typeof AuthAdministrationIndexRoute; "/_auth/questionnaire/": typeof AuthQuestionnaireIndexRoute; "/_auth/administration/carers/new": typeof AuthAdministrationCarersNewRoute; + "/_auth/administration/languages/new": typeof AuthAdministrationLanguagesNewRoute; "/_auth/administration/users/new": typeof AuthAdministrationUsersNewRoute; "/_auth/administration/carers/": typeof AuthAdministrationCarersIndexRoute; + "/_auth/administration/languages/": typeof AuthAdministrationLanguagesIndexRoute; "/_auth/administration/users/": typeof AuthAdministrationUsersIndexRoute; "/_auth/administration/carers/edit/$id": typeof AuthAdministrationCarersEditIdRoute; + "/_auth/administration/languages/edit/$id": typeof AuthAdministrationLanguagesEditIdRoute; "/_auth/administration/users/edit/$id": typeof AuthAdministrationUsersEditIdRoute; } @@ -481,27 +555,32 @@ export interface FileRouteTypes { | "/administration/" | "/questionnaire/" | "/administration/carers/new" + | "/administration/languages/new" | "/administration/users/new" | "/administration/carers/" + | "/administration/languages/" | "/administration/users/" | "/administration/carers/edit/$id" + | "/administration/languages/edit/$id" | "/administration/users/edit/$id"; fileRoutesByTo: FileRoutesByTo; to: | "/session" | "/" | "/administration/export" - | "/administration/languages" | "/administration/participants" | "/administration/questionnaires" | "/administration/studies" | "/administration" | "/questionnaire" | "/administration/carers/new" + | "/administration/languages/new" | "/administration/users/new" | "/administration/carers" + | "/administration/languages" | "/administration/users" | "/administration/carers/edit/$id" + | "/administration/languages/edit/$id" | "/administration/users/edit/$id"; id: | "__root__" @@ -520,10 +599,13 @@ export interface FileRouteTypes { | "/_auth/administration/" | "/_auth/questionnaire/" | "/_auth/administration/carers/new" + | "/_auth/administration/languages/new" | "/_auth/administration/users/new" | "/_auth/administration/carers/" + | "/_auth/administration/languages/" | "/_auth/administration/users/" | "/_auth/administration/carers/edit/$id" + | "/_auth/administration/languages/edit/$id" | "/_auth/administration/users/edit/$id"; fileRoutesById: FileRoutesById; } @@ -603,7 +685,12 @@ export const routeTree = rootRoute }, "/_auth/administration/languages": { "filePath": "_auth/administration/languages.tsx", - "parent": "/_auth/administration" + "parent": "/_auth/administration", + "children": [ + "/_auth/administration/languages/new", + "/_auth/administration/languages/", + "/_auth/administration/languages/edit/$id" + ] }, "/_auth/administration/participants": { "filePath": "_auth/administration/participants.tsx", @@ -638,6 +725,10 @@ export const routeTree = rootRoute "filePath": "_auth/administration/carers/new.tsx", "parent": "/_auth/administration/carers" }, + "/_auth/administration/languages/new": { + "filePath": "_auth/administration/languages/new.tsx", + "parent": "/_auth/administration/languages" + }, "/_auth/administration/users/new": { "filePath": "_auth/administration/users/new.tsx", "parent": "/_auth/administration/users" @@ -646,6 +737,10 @@ export const routeTree = rootRoute "filePath": "_auth/administration/carers/index.tsx", "parent": "/_auth/administration/carers" }, + "/_auth/administration/languages/": { + "filePath": "_auth/administration/languages/index.tsx", + "parent": "/_auth/administration/languages" + }, "/_auth/administration/users/": { "filePath": "_auth/administration/users/index.tsx", "parent": "/_auth/administration/users" @@ -654,6 +749,10 @@ export const routeTree = rootRoute "filePath": "_auth/administration/carers/edit.$id.tsx", "parent": "/_auth/administration/carers" }, + "/_auth/administration/languages/edit/$id": { + "filePath": "_auth/administration/languages/edit.$id.tsx", + "parent": "/_auth/administration/languages" + }, "/_auth/administration/users/edit/$id": { "filePath": "_auth/administration/users/edit.$id.tsx", "parent": "/_auth/administration/users" diff --git a/apps/frontend/src/routes/_auth/administration/carers/index.tsx b/apps/frontend/src/routes/_auth/administration/carers/index.tsx index 71c95af..14aebf0 100644 --- a/apps/frontend/src/routes/_auth/administration/carers/index.tsx +++ b/apps/frontend/src/routes/_auth/administration/carers/index.tsx @@ -5,7 +5,7 @@ import { useSuspenseQuery } from "@tanstack/react-query"; function AdministrationCarerIndex() { const carers = useSuspenseQuery($api.queryOptions("get", "/carers")); - const deleteUserMutation = $api.useMutation("delete", "/carers/{id}", { + const deleteCarerMutation = $api.useMutation("delete", "/carers/{id}", { onSuccess: () => carers.refetch(), }); @@ -33,7 +33,7 @@ function AdministrationCarerIndex() { + + + ); +} + +export const Route = createFileRoute("/_auth/administration/languages/edit/$id")({ + loader: ({ params, context: { queryClient } }) => + queryClient.ensureQueryData( + $api.queryOptions("get", "/languages/{id}", { + params: { path: { id: params.id } }, + }) + ), + component: AdministrationLanguagesEdit, +}); diff --git a/apps/frontend/src/routes/_auth/administration/languages/index.tsx b/apps/frontend/src/routes/_auth/administration/languages/index.tsx new file mode 100644 index 0000000..229eb3e --- /dev/null +++ b/apps/frontend/src/routes/_auth/administration/languages/index.tsx @@ -0,0 +1,57 @@ +import { createFileRoute, Link } from "@tanstack/react-router"; +import { $api } from "../../../../stores/api"; +import { Button, Table } from "@quassel/ui"; +import { useSuspenseQuery } from "@tanstack/react-query"; + +function AdministrationLanguageIndex() { + const languages = useSuspenseQuery($api.queryOptions("get", "/languages")); + const deleteLanguageMutation = $api.useMutation("delete", "/languages/{id}", { + onSuccess: () => languages.refetch(), + }); + + return ( + <> + + + + + Id + Name + IETF BCP 47 + + + + {languages.data?.map((l) => ( + + {l.id} + {l.name} + {l.ietfBcp47} + + + + + + ))} + +
+ + ); +} + +export const Route = createFileRoute("/_auth/administration/languages/")({ + loader: ({ context: { queryClient } }) => queryClient.ensureQueryData($api.queryOptions("get", "/languages")), + component: AdministrationLanguageIndex, +}); diff --git a/apps/frontend/src/routes/_auth/administration/languages/new.tsx b/apps/frontend/src/routes/_auth/administration/languages/new.tsx new file mode 100644 index 0000000..1dc890d --- /dev/null +++ b/apps/frontend/src/routes/_auth/administration/languages/new.tsx @@ -0,0 +1,43 @@ +import { useForm } from "@mantine/form"; +import { createFileRoute, useNavigate } from "@tanstack/react-router"; +import { Button, TextInput } from "@quassel/ui"; +import { $api } from "../../../../stores/api"; +import { components } from "../../../../api.gen"; + +type FormValues = components["schemas"]["LanguageCreationDto"]; + +function AdministrationLanguagesNew() { + const n = useNavigate(); + const createLanguageMutation = $api.useMutation("post", "/languages", { + onSuccess: () => { + n({ to: "/administration/languages" }); + }, + }); + const f = useForm({ + mode: "uncontrolled", + initialValues: { + name: "", + ietfBcp47: "", + }, + }); + const handleSubmit = (values: FormValues) => { + createLanguageMutation.mutate({ body: values }); + }; + + return ( + <> +
+ + + + + + + ); +} + +export const Route = createFileRoute("/_auth/administration/languages/new")({ + component: AdministrationLanguagesNew, +}); diff --git a/apps/frontend/src/routes/_auth/administration/users/index.tsx b/apps/frontend/src/routes/_auth/administration/users/index.tsx index 386a25c..611df89 100644 --- a/apps/frontend/src/routes/_auth/administration/users/index.tsx +++ b/apps/frontend/src/routes/_auth/administration/users/index.tsx @@ -45,5 +45,5 @@ function AdministrationUsersIndex() { export const Route = createFileRoute("/_auth/administration/users/")({ loader: ({ context: { queryClient } }) => queryClient.ensureQueryData($api.queryOptions("get", "/users")), - component: () => , + component: AdministrationUsersIndex, }); From 15dd08e355f76587aa9aa8a2b037eb637d9b41cc Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 4 Nov 2024 04:58:27 +0000 Subject: [PATCH 4/4] chore: add changeset --- .changeset/short-bees-reflect.md | 5 +++ pnpm-lock.yaml | 65 +++++++++++++++----------------- 2 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 .changeset/short-bees-reflect.md diff --git a/.changeset/short-bees-reflect.md b/.changeset/short-bees-reflect.md new file mode 100644 index 0000000..f920cfa --- /dev/null +++ b/.changeset/short-bees-reflect.md @@ -0,0 +1,5 @@ +--- +"@quassel/frontend": patch +--- + +Add default values management ui diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 40323ce..e98caf5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -966,8 +966,8 @@ packages: react: '>=16.8.0' react-dom: '>=16.8.0' - '@floating-ui/react@0.26.26': - resolution: {integrity: sha512-iv2BjdcyoF1j1708Z9CrGtMc9ZZvMPZnDqyB1FrSWYCi+/nlPArUO/u9QhwC4E1Pi4T0g18GZ4W702m0NDh9bw==} + '@floating-ui/react@0.26.27': + resolution: {integrity: sha512-jLP72x0Kr2CgY6eTYi/ra3VA9LOkTo4C+DUTrbFgFOExKy3omYVmwMjNKqxAHdsnyLS96BIDLcO2SlnsNf8KUQ==} peerDependencies: react: '>=16.8.0' react-dom: '>=16.8.0' @@ -1516,11 +1516,11 @@ packages: '@redocly/ajv@8.11.2': resolution: {integrity: sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==} - '@redocly/config@0.15.0': - resolution: {integrity: sha512-QmzuqbhzrbiktRGw+FV7iim+TsfQRU8crJb2s7ls8gP+BMkE1RHZnmJ1lAA/QwzyXbEmKZeGFTdM6PWuRwNlRA==} + '@redocly/config@0.16.0': + resolution: {integrity: sha512-t9jnODbUcuANRSl/K4L9nb12V+U5acIHnVSl26NWrtSdDZVtoqUXk2yGFPZzohYf62cCfEQUT8ouJ3bhPfpnJg==} - '@redocly/openapi-core@1.25.9': - resolution: {integrity: sha512-tod9bhIxBJQOeGQ3Ot5Zk707Wcg5YgEcEG766cGxwHqjRUNF5kwZnleBO7CpaLusOMWnQefj7RfFWLZS+IqnhA==} + '@redocly/openapi-core@1.25.10': + resolution: {integrity: sha512-wcGnSonJZvjpPaJJs+qh0ADYy0aCbaNhCXhJVES9RlknMc7V9nbqLQ67lkwaXhpp/fskm9GJWL/U9Xyiuclbqw==} engines: {node: '>=14.19.0', npm: '>=7.0.0'} '@renovate/pep440@1.0.0': @@ -2437,8 +2437,8 @@ packages: resolution: {integrity: sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==} engines: {node: '>=14.16'} - caniuse-lite@1.0.30001676: - resolution: {integrity: sha512-Qz6zwGCiPghQXGJvgQAem79esjitvJ+CxSbSQkW9H/UX5hg8XM88d4lp2W+MEQ81j+Hip58Il+jGVdazk1z9cw==} + caniuse-lite@1.0.30001677: + resolution: {integrity: sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog==} chai@5.1.2: resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} @@ -2872,8 +2872,8 @@ packages: engines: {node: '>=0.10.0'} hasBin: true - electron-to-chromium@1.5.49: - resolution: {integrity: sha512-ZXfs1Of8fDb6z7WEYZjXpgIRF6MEu8JdeGA0A40aZq6OQbS+eJpnnV49epZRna2DU/YsEjSQuGtQPPtvt6J65A==} + electron-to-chromium@1.5.50: + resolution: {integrity: sha512-eMVObiUQ2LdgeO1F/ySTXsvqvxb6ZH2zPGaMYsWzRDdOddUa77tdmI0ltg+L16UpbWdhPmuF3wIQYyQq65WfZw==} emittery@0.13.1: resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} @@ -5311,11 +5311,11 @@ packages: resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} engines: {node: '>=14.0.0'} - tldts-core@6.1.57: - resolution: {integrity: sha512-lXnRhuQpx3zU9EONF9F7HfcRLvN1uRYUBIiKL+C/gehC/77XTU+Jye6ui86GA3rU6FjlJ0triD1Tkjt2F/2lEg==} + tldts-core@6.1.58: + resolution: {integrity: sha512-dR936xmhBm7AeqHIhCWwK765gZ7dFyL+IqLSFAjJbFlUXGMLCb8i2PzlzaOuWBuplBTaBYseSb565nk/ZEM0Bg==} - tldts@6.1.57: - resolution: {integrity: sha512-Oy7yDXK8meJl8vPMOldzA+MtueAJ5BrH4l4HXwZuj2AtfoQbLjmTJmjNWPUcAo+E/ibHn7QlqMS0BOcXJFJyHQ==} + tldts@6.1.58: + resolution: {integrity: sha512-MQJrJhjHOYGYb8DobR6Y4AdDbd4TYkyQ+KBDVc5ODzs1cbrvPpfN1IemYi9jfipJ/vR1YWvrDli0hg1y19VRoA==} hasBin: true tmp@0.0.33: @@ -5421,9 +5421,6 @@ packages: tslib@2.7.0: resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} - tslib@2.8.0: - resolution: {integrity: sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==} - tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -6602,7 +6599,7 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - '@floating-ui/react@0.26.26(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@floating-ui/react@0.26.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@floating-ui/react-dom': 2.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@floating-ui/utils': 0.2.8 @@ -6849,7 +6846,7 @@ snapshots: '@mantine/core@7.13.4(@mantine/hooks@7.13.4(react@18.3.1))(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@floating-ui/react': 0.26.26(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@floating-ui/react': 0.26.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mantine/hooks': 7.13.4(react@18.3.1) clsx: 2.1.1 react: 18.3.1 @@ -7376,12 +7373,12 @@ snapshots: require-from-string: 2.0.2 uri-js-replace: 1.0.1 - '@redocly/config@0.15.0': {} + '@redocly/config@0.16.0': {} - '@redocly/openapi-core@1.25.9(supports-color@9.4.0)': + '@redocly/openapi-core@1.25.10(supports-color@9.4.0)': dependencies: '@redocly/ajv': 8.11.2 - '@redocly/config': 0.15.0 + '@redocly/config': 0.16.0 colorette: 1.4.0 https-proxy-agent: 7.0.5(supports-color@9.4.0) js-levenshtein: 1.1.6 @@ -8470,8 +8467,8 @@ snapshots: browserslist@4.24.2: dependencies: - caniuse-lite: 1.0.30001676 - electron-to-chromium: 1.5.49 + caniuse-lite: 1.0.30001677 + electron-to-chromium: 1.5.50 node-releases: 2.0.18 update-browserslist-db: 1.1.1(browserslist@4.24.2) @@ -8520,7 +8517,7 @@ snapshots: camelcase@7.0.1: {} - caniuse-lite@1.0.30001676: {} + caniuse-lite@1.0.30001677: {} chai@5.1.2: dependencies: @@ -8915,7 +8912,7 @@ snapshots: dependencies: jake: 10.9.2 - electron-to-chromium@1.5.49: {} + electron-to-chromium@1.5.50: {} emittery@0.13.1: {} @@ -10844,7 +10841,7 @@ snapshots: openapi-typescript@7.4.2(typescript@5.6.3): dependencies: - '@redocly/openapi-core': 1.25.9(supports-color@9.4.0) + '@redocly/openapi-core': 1.25.10(supports-color@9.4.0) ansi-colors: 4.1.3 change-case: 5.4.4 parse-json: 8.1.0 @@ -11374,7 +11371,7 @@ snapshots: rxjs@7.8.1: dependencies: - tslib: 2.8.0 + tslib: 2.8.1 safe-array-concat@1.1.2: dependencies: @@ -11719,7 +11716,7 @@ snapshots: synckit@0.9.2: dependencies: '@pkgr/core': 0.1.1 - tslib: 2.8.0 + tslib: 2.8.1 tabbable@6.2.0: {} @@ -11789,11 +11786,11 @@ snapshots: tinyspy@3.0.2: {} - tldts-core@6.1.57: {} + tldts-core@6.1.58: {} - tldts@6.1.57: + tldts@6.1.58: dependencies: - tldts-core: 6.1.57 + tldts-core: 6.1.58 tmp@0.0.33: dependencies: @@ -11813,7 +11810,7 @@ snapshots: tough-cookie@5.0.0: dependencies: - tldts: 6.1.57 + tldts: 6.1.58 tr46@0.0.3: {} @@ -11893,8 +11890,6 @@ snapshots: tslib@2.7.0: {} - tslib@2.8.0: {} - tslib@2.8.1: {} tsx@4.19.2: