diff --git a/frontend/src/lib/client/schemas.gen.ts b/frontend/src/lib/client/schemas.gen.ts index b96d2b98..cfb330b7 100644 --- a/frontend/src/lib/client/schemas.gen.ts +++ b/frontend/src/lib/client/schemas.gen.ts @@ -590,6 +590,123 @@ export const UserCreateSchema = { title: 'UserCreate' } as const; +export const UserQuestionAdminSchema = { + properties: { + id: { + type: 'integer', + title: 'Id' + }, + order: { + type: 'integer', + title: 'Order' + }, + input: { + type: 'string', + title: 'Input' + }, + options: { + type: 'string', + title: 'Options' + }, + text: { + additionalProperties: { + $ref: '#/components/schemas/UserQuestionText' + }, + type: 'object', + title: 'Text', + default: {} + } + }, + type: 'object', + required: ['id', 'order', 'input', 'options'], + title: 'UserQuestionAdmin' +} as const; + +export const UserQuestionPublicSchema = { + properties: { + id: { + type: 'integer', + title: 'Id' + }, + input: { + type: 'string', + title: 'Input' + }, + text: { + additionalProperties: { + $ref: '#/components/schemas/UserQuestionTextPublic' + }, + type: 'object', + title: 'Text', + default: {} + } + }, + type: 'object', + required: ['id', 'input'], + title: 'UserQuestionPublic' +} as const; + +export const UserQuestionTextSchema = { + properties: { + question: { + type: 'string', + title: 'Question', + default: '' + }, + options_json: { + type: 'string', + title: 'Options Json', + default: '' + }, + user_question_id: { + anyOf: [ + { + type: 'integer' + }, + { + type: 'null' + } + ], + title: 'User Question Id' + }, + lang_id: { + anyOf: [ + { + type: 'integer' + }, + { + type: 'null' + } + ], + title: 'Lang Id' + }, + options: { + type: 'string', + title: 'Options', + default: '' + } + }, + type: 'object', + title: 'UserQuestionText' +} as const; + +export const UserQuestionTextPublicSchema = { + properties: { + question: { + type: 'string', + title: 'Question', + default: '' + }, + options_json: { + type: 'string', + title: 'Options Json', + default: '' + } + }, + type: 'object', + title: 'UserQuestionTextPublic' +} as const; + export const UserReadSchema = { properties: { id: { diff --git a/frontend/src/lib/client/services.gen.ts b/frontend/src/lib/client/services.gen.ts index 95ef15b9..fd496601 100644 --- a/frontend/src/lib/client/services.gen.ts +++ b/frontend/src/lib/client/services.gen.ts @@ -8,85 +8,97 @@ import { urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; import type { - GetLanguagesLanguagesGetError, - GetLanguagesLanguagesGetResponse, - GetMilestonesMilestonesGetError, - GetMilestonesMilestonesGetResponse, - GetMilestoneMilestonesMilestoneIdGetData, - GetMilestoneMilestonesMilestoneIdGetError, - GetMilestoneMilestonesMilestoneIdGetResponse, - GetMilestoneGroupsMilestoneGroupsGetError, - GetMilestoneGroupsMilestoneGroupsGetResponse, - GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetData, - GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetError, - GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetResponse, - CreateLanguageAdminLanguagesPostData, - CreateLanguageAdminLanguagesPostError, - CreateLanguageAdminLanguagesPostResponse, - DeleteLanguageAdminLanguagesLanguageIdDeleteData, - DeleteLanguageAdminLanguagesLanguageIdDeleteError, - DeleteLanguageAdminLanguagesLanguageIdDeleteResponse, - GetMilestoneGroupsAdminMilestoneGroupsGetError, - GetMilestoneGroupsAdminMilestoneGroupsGetResponse, - CreateMilestoneGroupAdminMilestoneGroupsPostError, - CreateMilestoneGroupAdminMilestoneGroupsPostResponse, - UpdateMilestoneGroupAdminMilestoneGroupsPutData, - UpdateMilestoneGroupAdminMilestoneGroupsPutError, - UpdateMilestoneGroupAdminMilestoneGroupsPutResponse, - DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteData, - DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteError, - DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteResponse, - UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutData, - UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutError, - UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutResponse, - CreateMilestoneAdminMilestonesMilestoneGroupIdPostData, - CreateMilestoneAdminMilestonesMilestoneGroupIdPostError, - CreateMilestoneAdminMilestonesMilestoneGroupIdPostResponse, - UpdateMilestoneAdminMilestonesPutData, - UpdateMilestoneAdminMilestonesPutError, - UpdateMilestoneAdminMilestonesPutResponse, - DeleteMilestoneAdminMilestonesMilestoneIdDeleteData, - DeleteMilestoneAdminMilestonesMilestoneIdDeleteError, - DeleteMilestoneAdminMilestonesMilestoneIdDeleteResponse, - UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostData, - UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostError, - UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostResponse, - UsersCurrentUserUsersMeGetError, - UsersCurrentUserUsersMeGetResponse, - UsersPatchCurrentUserUsersMePatchData, - UsersPatchCurrentUserUsersMePatchError, - UsersPatchCurrentUserUsersMePatchResponse, - UsersUserUsersIdGetData, - UsersUserUsersIdGetError, - UsersUserUsersIdGetResponse, - UsersPatchUserUsersIdPatchData, - UsersPatchUserUsersIdPatchError, - UsersPatchUserUsersIdPatchResponse, - UsersDeleteUserUsersIdDeleteData, - UsersDeleteUserUsersIdDeleteError, - UsersDeleteUserUsersIdDeleteResponse, - AuthCookieLoginAuthLoginPostData, - AuthCookieLoginAuthLoginPostError, - AuthCookieLoginAuthLoginPostResponse, - AuthCookieLogoutAuthLogoutPostError, - AuthCookieLogoutAuthLogoutPostResponse, - RegisterRegisterAuthRegisterPostData, - RegisterRegisterAuthRegisterPostError, - RegisterRegisterAuthRegisterPostResponse, - ResetForgotPasswordAuthForgotPasswordPostData, - ResetForgotPasswordAuthForgotPasswordPostError, - ResetForgotPasswordAuthForgotPasswordPostResponse, - ResetResetPasswordAuthResetPasswordPostData, - ResetResetPasswordAuthResetPasswordPostError, - ResetResetPasswordAuthResetPasswordPostResponse, - VerifyRequestTokenAuthRequestVerifyTokenPostData, - VerifyRequestTokenAuthRequestVerifyTokenPostError, - VerifyRequestTokenAuthRequestVerifyTokenPostResponse, - VerifyVerifyAuthVerifyPostData, - VerifyVerifyAuthVerifyPostError, - VerifyVerifyAuthVerifyPostResponse, - AuthResearchAuthGetError, - AuthResearchAuthGetResponse + GetLanguagesError, + GetLanguagesResponse, + GetMilestonesError, + GetMilestonesResponse, + GetMilestoneData, + GetMilestoneError, + GetMilestoneResponse, + GetMilestoneGroupsError, + GetMilestoneGroupsResponse, + GetMilestoneGroupData, + GetMilestoneGroupError, + GetMilestoneGroupResponse, + GetUserQuestionsError, + GetUserQuestionsResponse, + CreateLanguageData, + CreateLanguageError, + CreateLanguageResponse, + DeleteLanguageData, + DeleteLanguageError, + DeleteLanguageResponse, + GetMilestoneGroupsAdminError, + GetMilestoneGroupsAdminResponse, + CreateMilestoneGroupAdminError, + CreateMilestoneGroupAdminResponse, + UpdateMilestoneGroupAdminData, + UpdateMilestoneGroupAdminError, + UpdateMilestoneGroupAdminResponse, + DeleteMilestoneGroupAdminData, + DeleteMilestoneGroupAdminError, + DeleteMilestoneGroupAdminResponse, + UploadMilestoneGroupImageData, + UploadMilestoneGroupImageError, + UploadMilestoneGroupImageResponse, + CreateMilestoneData, + CreateMilestoneError, + CreateMilestoneResponse, + UpdateMilestoneData, + UpdateMilestoneError, + UpdateMilestoneResponse, + DeleteMilestoneData, + DeleteMilestoneError, + DeleteMilestoneResponse, + UploadMilestoneImageData, + UploadMilestoneImageError, + UploadMilestoneImageResponse, + GetUserQuestions1Error, + GetUserQuestions1Response, + UpdateUserQuestionData, + UpdateUserQuestionError, + UpdateUserQuestionResponse, + CreateUserQuestionError, + CreateUserQuestionResponse, + DeleteQuestionData, + DeleteQuestionError, + DeleteQuestionResponse, + UsersCurrentUserError, + UsersCurrentUserResponse, + UsersPatchCurrentUserData, + UsersPatchCurrentUserError, + UsersPatchCurrentUserResponse, + UsersUserData, + UsersUserError, + UsersUserResponse, + UsersPatchUserData, + UsersPatchUserError, + UsersPatchUserResponse, + UsersDeleteUserData, + UsersDeleteUserError, + UsersDeleteUserResponse, + AuthCookieLoginData, + AuthCookieLoginError, + AuthCookieLoginResponse, + AuthCookieLogoutError, + AuthCookieLogoutResponse, + RegisterRegisterData, + RegisterRegisterError, + RegisterRegisterResponse, + ResetForgotPasswordData, + ResetForgotPasswordError, + ResetForgotPasswordResponse, + ResetResetPasswordData, + ResetResetPasswordError, + ResetResetPasswordResponse, + VerifyRequestTokenData, + VerifyRequestTokenError, + VerifyRequestTokenResponse, + VerifyVerifyData, + VerifyVerifyError, + VerifyVerifyResponse, + AuthError, + AuthResponse } from './types.gen'; export const client = createClient(createConfig()); @@ -94,14 +106,10 @@ export const client = createClient(createConfig()); /** * Get Languages */ -export const getLanguagesLanguagesGet = ( +export const getLanguages = ( options?: Options ) => { - return (options?.client ?? client).get< - GetLanguagesLanguagesGetResponse, - GetLanguagesLanguagesGetError, - ThrowOnError - >({ + return (options?.client ?? client).get({ ...options, url: '/languages/' }); @@ -110,14 +118,10 @@ export const getLanguagesLanguagesGet = ( /** * Get Milestones */ -export const getMilestonesMilestonesGet = ( +export const getMilestones = ( options?: Options ) => { - return (options?.client ?? client).get< - GetMilestonesMilestonesGetResponse, - GetMilestonesMilestonesGetError, - ThrowOnError - >({ + return (options?.client ?? client).get({ ...options, url: '/milestones/' }); @@ -126,14 +130,10 @@ export const getMilestonesMilestonesGet = /** * Get Milestone */ -export const getMilestoneMilestonesMilestoneIdGet = ( - options: Options +export const getMilestone = ( + options: Options ) => { - return (options?.client ?? client).get< - GetMilestoneMilestonesMilestoneIdGetResponse, - GetMilestoneMilestonesMilestoneIdGetError, - ThrowOnError - >({ + return (options?.client ?? client).get({ ...options, url: '/milestones/{milestone_id}' }); @@ -142,12 +142,12 @@ export const getMilestoneMilestonesMilestoneIdGet = ( +export const getMilestoneGroups = ( options?: Options ) => { return (options?.client ?? client).get< - GetMilestoneGroupsMilestoneGroupsGetResponse, - GetMilestoneGroupsMilestoneGroupsGetError, + GetMilestoneGroupsResponse, + GetMilestoneGroupsError, ThrowOnError >({ ...options, @@ -158,14 +158,12 @@ export const getMilestoneGroupsMilestoneGroupsGet = ( - options: Options +export const getMilestoneGroup = ( + options: Options ) => { return (options?.client ?? client).get< - GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetResponse, - GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetError, + GetMilestoneGroupResponse, + GetMilestoneGroupError, ThrowOnError >({ ...options, @@ -173,15 +171,31 @@ export const getMilestoneGroupMilestoneGroupsMilestoneGroupIdGet = < }); }; +/** + * Get User Questions + */ +export const getUserQuestions = ( + options?: Options +) => { + return (options?.client ?? client).get< + GetUserQuestionsResponse, + GetUserQuestionsError, + ThrowOnError + >({ + ...options, + url: '/user-questions/' + }); +}; + /** * Create Language */ -export const createLanguageAdminLanguagesPost = ( - options: Options +export const createLanguage = ( + options: Options ) => { return (options?.client ?? client).post< - CreateLanguageAdminLanguagesPostResponse, - CreateLanguageAdminLanguagesPostError, + CreateLanguageResponse, + CreateLanguageError, ThrowOnError >({ ...options, @@ -192,12 +206,12 @@ export const createLanguageAdminLanguagesPost = ( - options: Options +export const deleteLanguage = ( + options: Options ) => { return (options?.client ?? client).delete< - DeleteLanguageAdminLanguagesLanguageIdDeleteResponse, - DeleteLanguageAdminLanguagesLanguageIdDeleteError, + DeleteLanguageResponse, + DeleteLanguageError, ThrowOnError >({ ...options, @@ -206,14 +220,14 @@ export const deleteLanguageAdminLanguagesLanguageIdDelete = ( +export const getMilestoneGroupsAdmin = ( options?: Options ) => { return (options?.client ?? client).get< - GetMilestoneGroupsAdminMilestoneGroupsGetResponse, - GetMilestoneGroupsAdminMilestoneGroupsGetError, + GetMilestoneGroupsAdminResponse, + GetMilestoneGroupsAdminError, ThrowOnError >({ ...options, @@ -222,14 +236,14 @@ export const getMilestoneGroupsAdminMilestoneGroupsGet = ( +export const createMilestoneGroupAdmin = ( options?: Options ) => { return (options?.client ?? client).post< - CreateMilestoneGroupAdminMilestoneGroupsPostResponse, - CreateMilestoneGroupAdminMilestoneGroupsPostError, + CreateMilestoneGroupAdminResponse, + CreateMilestoneGroupAdminError, ThrowOnError >({ ...options, @@ -238,14 +252,14 @@ export const createMilestoneGroupAdminMilestoneGroupsPost = ( - options: Options +export const updateMilestoneGroupAdmin = ( + options: Options ) => { return (options?.client ?? client).put< - UpdateMilestoneGroupAdminMilestoneGroupsPutResponse, - UpdateMilestoneGroupAdminMilestoneGroupsPutError, + UpdateMilestoneGroupAdminResponse, + UpdateMilestoneGroupAdminError, ThrowOnError >({ ...options, @@ -254,16 +268,14 @@ export const updateMilestoneGroupAdminMilestoneGroupsPut = ( - options: Options +export const deleteMilestoneGroupAdmin = ( + options: Options ) => { return (options?.client ?? client).delete< - DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteResponse, - DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteError, + DeleteMilestoneGroupAdminResponse, + DeleteMilestoneGroupAdminError, ThrowOnError >({ ...options, @@ -274,17 +286,12 @@ export const deleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDelete = < /** * Upload Milestone Group Image */ -export const uploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPut = < - ThrowOnError extends boolean = false ->( - options: Options< - UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutData, - ThrowOnError - > +export const uploadMilestoneGroupImage = ( + options: Options ) => { return (options?.client ?? client).put< - UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutResponse, - UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutError, + UploadMilestoneGroupImageResponse, + UploadMilestoneGroupImageError, ThrowOnError >({ ...options, @@ -300,14 +307,12 @@ export const uploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdP /** * Create Milestone */ -export const createMilestoneAdminMilestonesMilestoneGroupIdPost = < - ThrowOnError extends boolean = false ->( - options: Options +export const createMilestone = ( + options: Options ) => { return (options?.client ?? client).post< - CreateMilestoneAdminMilestonesMilestoneGroupIdPostResponse, - CreateMilestoneAdminMilestonesMilestoneGroupIdPostError, + CreateMilestoneResponse, + CreateMilestoneError, ThrowOnError >({ ...options, @@ -318,30 +323,28 @@ export const createMilestoneAdminMilestonesMilestoneGroupIdPost = < /** * Update Milestone */ -export const updateMilestoneAdminMilestonesPut = ( - options: Options +export const updateMilestone = ( + options: Options ) => { return (options?.client ?? client).put< - UpdateMilestoneAdminMilestonesPutResponse, - UpdateMilestoneAdminMilestonesPutError, + UpdateMilestoneResponse, + UpdateMilestoneError, ThrowOnError >({ ...options, - url: '/admin/milestones' + url: '/admin/milestones/' }); }; /** * Delete Milestone */ -export const deleteMilestoneAdminMilestonesMilestoneIdDelete = < - ThrowOnError extends boolean = false ->( - options: Options +export const deleteMilestone = ( + options: Options ) => { return (options?.client ?? client).delete< - DeleteMilestoneAdminMilestonesMilestoneIdDeleteResponse, - DeleteMilestoneAdminMilestonesMilestoneIdDeleteError, + DeleteMilestoneResponse, + DeleteMilestoneError, ThrowOnError >({ ...options, @@ -352,14 +355,12 @@ export const deleteMilestoneAdminMilestonesMilestoneIdDelete = < /** * Upload Milestone Image */ -export const uploadMilestoneImageAdminMilestoneImagesMilestoneIdPost = < - ThrowOnError extends boolean = false ->( - options: Options +export const uploadMilestoneImage = ( + options: Options ) => { return (options?.client ?? client).post< - UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostResponse, - UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostError, + UploadMilestoneImageResponse, + UploadMilestoneImageError, ThrowOnError >({ ...options, @@ -372,15 +373,79 @@ export const uploadMilestoneImageAdminMilestoneImagesMilestoneIdPost = < }); }; +/** + * Get User Questions + */ +export const getUserQuestions1 = ( + options?: Options +) => { + return (options?.client ?? client).get< + GetUserQuestions1Response, + GetUserQuestions1Error, + ThrowOnError + >({ + ...options, + url: '/admin/user-questions/' + }); +}; + +/** + * Update User Question + */ +export const updateUserQuestion = ( + options: Options +) => { + return (options?.client ?? client).put< + UpdateUserQuestionResponse, + UpdateUserQuestionError, + ThrowOnError + >({ + ...options, + url: '/admin/user-questions/' + }); +}; + +/** + * Create User Question + */ +export const createUserQuestion = ( + options?: Options +) => { + return (options?.client ?? client).post< + CreateUserQuestionResponse, + CreateUserQuestionError, + ThrowOnError + >({ + ...options, + url: '/admin/user-questions/' + }); +}; + +/** + * Delete Question + */ +export const deleteQuestion = ( + options: Options +) => { + return (options?.client ?? client).delete< + DeleteQuestionResponse, + DeleteQuestionError, + ThrowOnError + >({ + ...options, + url: '/admin/user-questions/{user_question_id}' + }); +}; + /** * Users:Current User */ -export const usersCurrentUserUsersMeGet = ( +export const usersCurrentUser = ( options?: Options ) => { return (options?.client ?? client).get< - UsersCurrentUserUsersMeGetResponse, - UsersCurrentUserUsersMeGetError, + UsersCurrentUserResponse, + UsersCurrentUserError, ThrowOnError >({ ...options, @@ -391,12 +456,12 @@ export const usersCurrentUserUsersMeGet = /** * Users:Patch Current User */ -export const usersPatchCurrentUserUsersMePatch = ( - options: Options +export const usersPatchCurrentUser = ( + options: Options ) => { return (options?.client ?? client).patch< - UsersPatchCurrentUserUsersMePatchResponse, - UsersPatchCurrentUserUsersMePatchError, + UsersPatchCurrentUserResponse, + UsersPatchCurrentUserError, ThrowOnError >({ ...options, @@ -407,14 +472,10 @@ export const usersPatchCurrentUserUsersMePatch = ( - options: Options +export const usersUser = ( + options: Options ) => { - return (options?.client ?? client).get< - UsersUserUsersIdGetResponse, - UsersUserUsersIdGetError, - ThrowOnError - >({ + return (options?.client ?? client).get({ ...options, url: '/users/{id}' }); @@ -423,12 +484,12 @@ export const usersUserUsersIdGet = ( /** * Users:Patch User */ -export const usersPatchUserUsersIdPatch = ( - options: Options +export const usersPatchUser = ( + options: Options ) => { return (options?.client ?? client).patch< - UsersPatchUserUsersIdPatchResponse, - UsersPatchUserUsersIdPatchError, + UsersPatchUserResponse, + UsersPatchUserError, ThrowOnError >({ ...options, @@ -439,12 +500,12 @@ export const usersPatchUserUsersIdPatch = /** * Users:Delete User */ -export const usersDeleteUserUsersIdDelete = ( - options: Options +export const usersDeleteUser = ( + options: Options ) => { return (options?.client ?? client).delete< - UsersDeleteUserUsersIdDeleteResponse, - UsersDeleteUserUsersIdDeleteError, + UsersDeleteUserResponse, + UsersDeleteUserError, ThrowOnError >({ ...options, @@ -455,12 +516,12 @@ export const usersDeleteUserUsersIdDelete = ( - options: Options +export const authCookieLogin = ( + options: Options ) => { return (options?.client ?? client).post< - AuthCookieLoginAuthLoginPostResponse, - AuthCookieLoginAuthLoginPostError, + AuthCookieLoginResponse, + AuthCookieLoginError, ThrowOnError >({ ...options, @@ -476,12 +537,12 @@ export const authCookieLoginAuthLoginPost = ( +export const authCookieLogout = ( options?: Options ) => { return (options?.client ?? client).post< - AuthCookieLogoutAuthLogoutPostResponse, - AuthCookieLogoutAuthLogoutPostError, + AuthCookieLogoutResponse, + AuthCookieLogoutError, ThrowOnError >({ ...options, @@ -492,12 +553,12 @@ export const authCookieLogoutAuthLogoutPost = ( - options: Options +export const registerRegister = ( + options: Options ) => { return (options?.client ?? client).post< - RegisterRegisterAuthRegisterPostResponse, - RegisterRegisterAuthRegisterPostError, + RegisterRegisterResponse, + RegisterRegisterError, ThrowOnError >({ ...options, @@ -508,12 +569,12 @@ export const registerRegisterAuthRegisterPost = ( - options: Options +export const resetForgotPassword = ( + options: Options ) => { return (options?.client ?? client).post< - ResetForgotPasswordAuthForgotPasswordPostResponse, - ResetForgotPasswordAuthForgotPasswordPostError, + ResetForgotPasswordResponse, + ResetForgotPasswordError, ThrowOnError >({ ...options, @@ -524,12 +585,12 @@ export const resetForgotPasswordAuthForgotPasswordPost = ( - options: Options +export const resetResetPassword = ( + options: Options ) => { return (options?.client ?? client).post< - ResetResetPasswordAuthResetPasswordPostResponse, - ResetResetPasswordAuthResetPasswordPostError, + ResetResetPasswordResponse, + ResetResetPasswordError, ThrowOnError >({ ...options, @@ -540,12 +601,12 @@ export const resetResetPasswordAuthResetPasswordPost = ( - options: Options +export const verifyRequestToken = ( + options: Options ) => { return (options?.client ?? client).post< - VerifyRequestTokenAuthRequestVerifyTokenPostResponse, - VerifyRequestTokenAuthRequestVerifyTokenPostError, + VerifyRequestTokenResponse, + VerifyRequestTokenError, ThrowOnError >({ ...options, @@ -556,14 +617,10 @@ export const verifyRequestTokenAuthRequestVerifyTokenPost = ( - options: Options +export const verifyVerify = ( + options: Options ) => { - return (options?.client ?? client).post< - VerifyVerifyAuthVerifyPostResponse, - VerifyVerifyAuthVerifyPostError, - ThrowOnError - >({ + return (options?.client ?? client).post({ ...options, url: '/auth/verify' }); @@ -572,14 +629,10 @@ export const verifyVerifyAuthVerifyPost = /** * Auth */ -export const authResearchAuthGet = ( +export const auth = ( options?: Options ) => { - return (options?.client ?? client).get< - AuthResearchAuthGetResponse, - AuthResearchAuthGetError, - ThrowOnError - >({ + return (options?.client ?? client).get({ ...options, url: '/research/auth/' }); diff --git a/frontend/src/lib/client/types.gen.ts b/frontend/src/lib/client/types.gen.ts index fa540a40..c2b3c84a 100644 --- a/frontend/src/lib/client/types.gen.ts +++ b/frontend/src/lib/client/types.gen.ts @@ -142,6 +142,37 @@ export type UserCreate = { is_researcher?: boolean | null; }; +export type UserQuestionAdmin = { + id: number; + order: number; + input: string; + options: string; + text?: { + [key: string]: UserQuestionText; + }; +}; + +export type UserQuestionPublic = { + id: number; + input: string; + text?: { + [key: string]: UserQuestionTextPublic; + }; +}; + +export type UserQuestionText = { + question?: string; + options_json?: string; + user_question_id?: number | null; + lang_id?: number | null; + options?: string; +}; + +export type UserQuestionTextPublic = { + question?: string; + options_json?: string; +}; + export type UserRead = { id: number; email: string; @@ -166,231 +197,259 @@ export type ValidationError = { type: string; }; -export type GetLanguagesLanguagesGetResponse = { +export type GetLanguagesResponse = { [key: string]: string; }; -export type GetLanguagesLanguagesGetError = unknown; +export type GetLanguagesError = unknown; -export type GetMilestonesMilestonesGetResponse = Array; +export type GetMilestonesResponse = Array; -export type GetMilestonesMilestonesGetError = unknown; +export type GetMilestonesError = unknown; -export type GetMilestoneMilestonesMilestoneIdGetData = { +export type GetMilestoneData = { path: { milestone_id: number; }; }; -export type GetMilestoneMilestonesMilestoneIdGetResponse = MilestonePublic; +export type GetMilestoneResponse = MilestonePublic; -export type GetMilestoneMilestonesMilestoneIdGetError = HTTPValidationError; +export type GetMilestoneError = HTTPValidationError; -export type GetMilestoneGroupsMilestoneGroupsGetResponse = Array; +export type GetMilestoneGroupsResponse = Array; -export type GetMilestoneGroupsMilestoneGroupsGetError = unknown; +export type GetMilestoneGroupsError = unknown; -export type GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetData = { +export type GetMilestoneGroupData = { path: { milestone_group_id: number; }; }; -export type GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetResponse = MilestoneGroupPublic; +export type GetMilestoneGroupResponse = MilestoneGroupPublic; -export type GetMilestoneGroupMilestoneGroupsMilestoneGroupIdGetError = HTTPValidationError; +export type GetMilestoneGroupError = HTTPValidationError; -export type CreateLanguageAdminLanguagesPostData = { +export type GetUserQuestionsResponse = Array; + +export type GetUserQuestionsError = unknown; + +export type CreateLanguageData = { body: LanguageCreate; }; -export type CreateLanguageAdminLanguagesPostResponse = Language; +export type CreateLanguageResponse = Language; -export type CreateLanguageAdminLanguagesPostError = HTTPValidationError; +export type CreateLanguageError = HTTPValidationError; -export type DeleteLanguageAdminLanguagesLanguageIdDeleteData = { +export type DeleteLanguageData = { path: { language_id: number; }; }; -export type DeleteLanguageAdminLanguagesLanguageIdDeleteResponse = Language; +export type DeleteLanguageResponse = unknown; -export type DeleteLanguageAdminLanguagesLanguageIdDeleteError = HTTPValidationError; +export type DeleteLanguageError = HTTPValidationError; -export type GetMilestoneGroupsAdminMilestoneGroupsGetResponse = Array; +export type GetMilestoneGroupsAdminResponse = Array; -export type GetMilestoneGroupsAdminMilestoneGroupsGetError = unknown; +export type GetMilestoneGroupsAdminError = unknown; -export type CreateMilestoneGroupAdminMilestoneGroupsPostResponse = MilestoneGroupAdmin_Output; +export type CreateMilestoneGroupAdminResponse = MilestoneGroupAdmin_Output; -export type CreateMilestoneGroupAdminMilestoneGroupsPostError = unknown; +export type CreateMilestoneGroupAdminError = unknown; -export type UpdateMilestoneGroupAdminMilestoneGroupsPutData = { +export type UpdateMilestoneGroupAdminData = { body: MilestoneGroupAdmin_Input; }; -export type UpdateMilestoneGroupAdminMilestoneGroupsPutResponse = MilestoneGroupAdmin_Output; +export type UpdateMilestoneGroupAdminResponse = MilestoneGroupAdmin_Output; -export type UpdateMilestoneGroupAdminMilestoneGroupsPutError = HTTPValidationError; +export type UpdateMilestoneGroupAdminError = HTTPValidationError; -export type DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteData = { +export type DeleteMilestoneGroupAdminData = { path: { milestone_group_id: number; }; }; -export type DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteResponse = unknown; +export type DeleteMilestoneGroupAdminResponse = unknown; -export type DeleteMilestoneGroupAdminMilestoneGroupsMilestoneGroupIdDeleteError = - HTTPValidationError; +export type DeleteMilestoneGroupAdminError = HTTPValidationError; -export type UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutData = { +export type UploadMilestoneGroupImageData = { body: Body_upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put; path: { milestone_group_id: number; }; }; -export type UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutResponse = unknown; +export type UploadMilestoneGroupImageResponse = unknown; -export type UploadMilestoneGroupImageAdminMilestoneGroupImagesMilestoneGroupIdPutError = - HTTPValidationError; +export type UploadMilestoneGroupImageError = HTTPValidationError; -export type CreateMilestoneAdminMilestonesMilestoneGroupIdPostData = { +export type CreateMilestoneData = { path: { milestone_group_id: number; }; }; -export type CreateMilestoneAdminMilestonesMilestoneGroupIdPostResponse = MilestoneAdmin; +export type CreateMilestoneResponse = MilestoneAdmin; -export type CreateMilestoneAdminMilestonesMilestoneGroupIdPostError = HTTPValidationError; +export type CreateMilestoneError = HTTPValidationError; -export type UpdateMilestoneAdminMilestonesPutData = { +export type UpdateMilestoneData = { body: MilestoneAdmin; }; -export type UpdateMilestoneAdminMilestonesPutResponse = MilestoneAdmin; +export type UpdateMilestoneResponse = MilestoneAdmin; -export type UpdateMilestoneAdminMilestonesPutError = HTTPValidationError; +export type UpdateMilestoneError = HTTPValidationError; -export type DeleteMilestoneAdminMilestonesMilestoneIdDeleteData = { +export type DeleteMilestoneData = { path: { milestone_id: number; }; }; -export type DeleteMilestoneAdminMilestonesMilestoneIdDeleteResponse = unknown; +export type DeleteMilestoneResponse = unknown; -export type DeleteMilestoneAdminMilestonesMilestoneIdDeleteError = HTTPValidationError; +export type DeleteMilestoneError = HTTPValidationError; -export type UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostData = { +export type UploadMilestoneImageData = { body: Body_upload_milestone_image_admin_milestone_images__milestone_id__post; path: { milestone_id: number; }; }; -export type UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostResponse = MilestoneImage; +export type UploadMilestoneImageResponse = MilestoneImage; + +export type UploadMilestoneImageError = HTTPValidationError; + +export type GetUserQuestions1Response = Array; + +export type GetUserQuestions1Error = unknown; + +export type UpdateUserQuestionData = { + body: UserQuestionAdmin; +}; + +export type UpdateUserQuestionResponse = UserQuestionAdmin; + +export type UpdateUserQuestionError = HTTPValidationError; + +export type CreateUserQuestionResponse = UserQuestionAdmin; + +export type CreateUserQuestionError = unknown; + +export type DeleteQuestionData = { + path: { + user_question_id: number; + }; +}; + +export type DeleteQuestionResponse = unknown; -export type UploadMilestoneImageAdminMilestoneImagesMilestoneIdPostError = HTTPValidationError; +export type DeleteQuestionError = HTTPValidationError; -export type UsersCurrentUserUsersMeGetResponse = UserRead; +export type UsersCurrentUserResponse = UserRead; -export type UsersCurrentUserUsersMeGetError = unknown; +export type UsersCurrentUserError = unknown; -export type UsersPatchCurrentUserUsersMePatchData = { +export type UsersPatchCurrentUserData = { body: UserUpdate; }; -export type UsersPatchCurrentUserUsersMePatchResponse = UserRead; +export type UsersPatchCurrentUserResponse = UserRead; -export type UsersPatchCurrentUserUsersMePatchError = ErrorModel | unknown | HTTPValidationError; +export type UsersPatchCurrentUserError = ErrorModel | unknown | HTTPValidationError; -export type UsersUserUsersIdGetData = { +export type UsersUserData = { path: { id: string; }; }; -export type UsersUserUsersIdGetResponse = UserRead; +export type UsersUserResponse = UserRead; -export type UsersUserUsersIdGetError = unknown | HTTPValidationError; +export type UsersUserError = unknown | HTTPValidationError; -export type UsersPatchUserUsersIdPatchData = { +export type UsersPatchUserData = { body: UserUpdate; path: { id: string; }; }; -export type UsersPatchUserUsersIdPatchResponse = UserRead; +export type UsersPatchUserResponse = UserRead; -export type UsersPatchUserUsersIdPatchError = ErrorModel | unknown | HTTPValidationError; +export type UsersPatchUserError = ErrorModel | unknown | HTTPValidationError; -export type UsersDeleteUserUsersIdDeleteData = { +export type UsersDeleteUserData = { path: { id: string; }; }; -export type UsersDeleteUserUsersIdDeleteResponse = void; +export type UsersDeleteUserResponse = void; -export type UsersDeleteUserUsersIdDeleteError = unknown | HTTPValidationError; +export type UsersDeleteUserError = unknown | HTTPValidationError; -export type AuthCookieLoginAuthLoginPostData = { +export type AuthCookieLoginData = { body: Body_auth_cookie_login_auth_login_post; }; -export type AuthCookieLoginAuthLoginPostResponse = unknown | void; +export type AuthCookieLoginResponse = unknown | void; -export type AuthCookieLoginAuthLoginPostError = ErrorModel | HTTPValidationError; +export type AuthCookieLoginError = ErrorModel | HTTPValidationError; -export type AuthCookieLogoutAuthLogoutPostResponse = unknown | void; +export type AuthCookieLogoutResponse = unknown | void; -export type AuthCookieLogoutAuthLogoutPostError = unknown; +export type AuthCookieLogoutError = unknown; -export type RegisterRegisterAuthRegisterPostData = { +export type RegisterRegisterData = { body: UserCreate; }; -export type RegisterRegisterAuthRegisterPostResponse = UserRead; +export type RegisterRegisterResponse = UserRead; -export type RegisterRegisterAuthRegisterPostError = ErrorModel | HTTPValidationError; +export type RegisterRegisterError = ErrorModel | HTTPValidationError; -export type ResetForgotPasswordAuthForgotPasswordPostData = { +export type ResetForgotPasswordData = { body: Body_reset_forgot_password_auth_forgot_password_post; }; -export type ResetForgotPasswordAuthForgotPasswordPostResponse = unknown; +export type ResetForgotPasswordResponse = unknown; -export type ResetForgotPasswordAuthForgotPasswordPostError = HTTPValidationError; +export type ResetForgotPasswordError = HTTPValidationError; -export type ResetResetPasswordAuthResetPasswordPostData = { +export type ResetResetPasswordData = { body: Body_reset_reset_password_auth_reset_password_post; }; -export type ResetResetPasswordAuthResetPasswordPostResponse = unknown; +export type ResetResetPasswordResponse = unknown; -export type ResetResetPasswordAuthResetPasswordPostError = ErrorModel | HTTPValidationError; +export type ResetResetPasswordError = ErrorModel | HTTPValidationError; -export type VerifyRequestTokenAuthRequestVerifyTokenPostData = { +export type VerifyRequestTokenData = { body: Body_verify_request_token_auth_request_verify_token_post; }; -export type VerifyRequestTokenAuthRequestVerifyTokenPostResponse = unknown; +export type VerifyRequestTokenResponse = unknown; -export type VerifyRequestTokenAuthRequestVerifyTokenPostError = HTTPValidationError; +export type VerifyRequestTokenError = HTTPValidationError; -export type VerifyVerifyAuthVerifyPostData = { +export type VerifyVerifyData = { body: Body_verify_verify_auth_verify_post; }; -export type VerifyVerifyAuthVerifyPostResponse = UserRead; +export type VerifyVerifyResponse = UserRead; -export type VerifyVerifyAuthVerifyPostError = ErrorModel | HTTPValidationError; +export type VerifyVerifyError = ErrorModel | HTTPValidationError; -export type AuthResearchAuthGetResponse = unknown; +export type AuthResponse = unknown; -export type AuthResearchAuthGetError = unknown; +export type AuthError = unknown; diff --git a/frontend/src/lib/components/Admin/Languages.svelte b/frontend/src/lib/components/Admin/Languages.svelte index 514f179a..3eafc508 100644 --- a/frontend/src/lib/components/Admin/Languages.svelte +++ b/frontend/src/lib/components/Admin/Languages.svelte @@ -17,6 +17,7 @@ import DeleteModal from '$lib/components/Admin/DeleteModal.svelte'; import AddButton from '$lib/components/Admin/AddButton.svelte'; import DeleteButton from '$lib/components/Admin/DeleteButton.svelte'; + import { createLanguage, deleteLanguage } from '$lib/client/services.gen'; const langCodes = ISO6391.getAllCodes(); const langNames = ISO6391.getAllNativeNames(); @@ -28,44 +29,23 @@ let currentLanguageId: string = ''; let showDeleteModal: boolean = false; - async function newLanguage() { - try { - const res = await fetch(`${import.meta.env.VITE_MONDEY_API_URL}/admin/languages`, { - method: 'POST', - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json' - }, - body: JSON.stringify({ lang: selectedLang }) - }); - if (res.status === 200) { - await updateLanguages(); - } else { - console.log('Failed to create new Language'); - } - } catch (e) { - console.error(e); + async function createLanguageAndUpdateLanguages() { + const { data, error } = await createLanguage({ body: { lang: selectedLang } }); + if (error) { + console.log(error); + } else { + console.log(data); + await updateLanguages(); } } - async function deleteLanguage(id: string) { - try { - const res = await fetch(`${import.meta.env.VITE_MONDEY_API_URL}/admin/languages/${id}`, { - method: 'DELETE', - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json' - } - }); - if (res.status === 200) { - await updateLanguages(); - } else { - console.log('Failed to create new Language'); - } - } catch (e) { - console.error(e); + async function deleteLanguageAndUpdateLanguages(id: string) { + const { data, error } = await deleteLanguage({ path: { language_id: Number(id) } }); + if (error) { + console.log(error); + } else { + console.log(data); + await updateLanguages(); } } @@ -108,7 +88,7 @@ /> - + @@ -118,6 +98,6 @@ { - deleteLanguage(currentLanguageId); + deleteLanguageAndUpdateLanguages(currentLanguageId); }} > diff --git a/frontend/src/lib/components/Admin/Login.svelte b/frontend/src/lib/components/Admin/Login.svelte index 79fde6d9..0dc3e5b7 100644 --- a/frontend/src/lib/components/Admin/Login.svelte +++ b/frontend/src/lib/components/Admin/Login.svelte @@ -1,28 +1,20 @@ @@ -30,12 +22,12 @@
Admin login
-
+
Password import('../locales/de.json')); register('en', () => import('../locales/en.json')); @@ -10,19 +11,8 @@ init({ }); export async function updateLanguages() { - try { - const res = await fetch(`${import.meta.env.VITE_MONDEY_API_URL}/languages`, { - method: 'GET', - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json' - } - }); - if (res.status === 200) { - languages.set(await res.json()); - } - } catch (e) { - console.error(e); + const { data, error } = await getLanguages(); + if (!error && data) { + languages.set(data); } } diff --git a/frontend/src/lib/stores/adminStore.ts b/frontend/src/lib/stores/adminStore.ts index dc540e32..e6e98175 100644 --- a/frontend/src/lib/stores/adminStore.ts +++ b/frontend/src/lib/stores/adminStore.ts @@ -1,4 +1,5 @@ import { writable, type Writable } from 'svelte/store'; +import type { GetLanguagesResponse } from '$lib/client/types.gen'; export const isLoggedIn = writable(false); @@ -6,6 +7,6 @@ export const milestoneGroups = writable([]); export const userQuestions = writable([]); -export const languages: Writable> = writable({}); +export const languages: Writable = writable({}); export const lang_id = writable('1'); diff --git a/frontend/src/routes/+layout.ts b/frontend/src/routes/+layout.ts index c5ec2913..fab1e8a8 100644 --- a/frontend/src/routes/+layout.ts +++ b/frontend/src/routes/+layout.ts @@ -1,7 +1,12 @@ import { waitLocale } from 'svelte-i18n'; +import { client } from '$lib/client/services.gen'; export const prerender = true; +client.setConfig({ + baseUrl: import.meta.env.VITE_MONDEY_API_URL +}); + export async function load() { await waitLocale(); } diff --git a/mondey_backend/openapi.json b/mondey_backend/openapi.json index 506b6e81..376456af 100644 --- a/mondey_backend/openapi.json +++ b/mondey_backend/openapi.json @@ -1 +1 @@ -{"openapi": "3.1.0", "info": {"title": "MONDEY API", "version": "0.1.0"}, "paths": {"/languages/": {"get": {"tags": ["milestones"], "summary": "Get Languages", "operationId": "get_languages_languages__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Response Get Languages Languages Get"}}}}}}}, "/milestones/": {"get": {"tags": ["milestones"], "summary": "Get Milestones", "operationId": "get_milestones_milestones__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/MilestonePublic"}, "type": "array", "title": "Response Get Milestones Milestones Get"}}}}}}}, "/milestones/{milestone_id}": {"get": {"tags": ["milestones"], "summary": "Get Milestone", "operationId": "get_milestone_milestones__milestone_id__get", "parameters": [{"name": "milestone_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestonePublic"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/milestone-groups/": {"get": {"tags": ["milestones"], "summary": "Get Milestone Groups", "operationId": "get_milestone_groups_milestone_groups__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/MilestoneGroupPublic"}, "type": "array", "title": "Response Get Milestone Groups Milestone Groups Get"}}}}}}}, "/milestone-groups/{milestone_group_id}": {"get": {"tags": ["milestones"], "summary": "Get Milestone Group", "operationId": "get_milestone_group_milestone_groups__milestone_group_id__get", "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupPublic"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/languages/": {"post": {"tags": ["admin"], "summary": "Create Language", "operationId": "create_language_admin_languages__post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/LanguageCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Language"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/languages/{language_id}": {"delete": {"tags": ["admin"], "summary": "Delete Language", "operationId": "delete_language_admin_languages__language_id__delete", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "language_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Language Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Language"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestone-groups/": {"get": {"tags": ["admin"], "summary": "Get Milestone Groups", "operationId": "get_milestone_groups_admin_milestone_groups__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Output"}, "type": "array", "title": "Response Get Milestone Groups Admin Milestone Groups Get"}}}}}, "security": [{"APIKeyCookie": []}]}, "post": {"tags": ["admin"], "summary": "Create Milestone Group", "operationId": "create_milestone_group_admin_milestone_groups__post", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Output"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/milestone-groups": {"put": {"tags": ["admin"], "summary": "Update Milestone Group", "operationId": "update_milestone_group_admin_milestone_groups_put", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Input"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Output"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/milestone-groups/{milestone_group_id}": {"delete": {"tags": ["admin"], "summary": "Delete Milestone Group", "operationId": "delete_milestone_group_admin_milestone_groups__milestone_group_id__delete", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestone-group-images/{milestone_group_id}": {"put": {"tags": ["admin"], "summary": "Upload Milestone Group Image", "operationId": "upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestones/{milestone_group_id}": {"post": {"tags": ["admin"], "summary": "Create Milestone", "operationId": "create_milestone_admin_milestones__milestone_group_id__post", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneAdmin"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestones": {"put": {"tags": ["admin"], "summary": "Update Milestone", "operationId": "update_milestone_admin_milestones_put", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneAdmin"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneAdmin"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/milestones/{milestone_id}": {"delete": {"tags": ["admin"], "summary": "Delete Milestone", "operationId": "delete_milestone_admin_milestones__milestone_id__delete", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestone-images/{milestone_id}": {"post": {"tags": ["admin"], "summary": "Upload Milestone Image", "operationId": "upload_milestone_image_admin_milestone_images__milestone_id__post", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Id"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_upload_milestone_image_admin_milestone_images__milestone_id__post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneImage"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/users/me": {"get": {"tags": ["users"], "summary": "Users:Current User", "operationId": "users_current_user_users_me_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}}, "security": [{"APIKeyCookie": []}]}, "patch": {"tags": ["users"], "summary": "Users:Patch Current User", "operationId": "users_patch_current_user_users_me_patch", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserUpdate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"UPDATE_USER_EMAIL_ALREADY_EXISTS": {"summary": "A user with this email already exists.", "value": {"detail": "UPDATE_USER_EMAIL_ALREADY_EXISTS"}}, "UPDATE_USER_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "UPDATE_USER_INVALID_PASSWORD", "reason": "Password should beat least 3 characters"}}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/users/{id}": {"get": {"tags": ["users"], "summary": "Users:User", "operationId": "users_user_users__id__get", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}, "403": {"description": "Not a superuser."}, "404": {"description": "The user does not exist."}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "patch": {"tags": ["users"], "summary": "Users:Patch User", "operationId": "users_patch_user_users__id__patch", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserUpdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}, "403": {"description": "Not a superuser."}, "404": {"description": "The user does not exist."}, "400": {"content": {"application/json": {"examples": {"UPDATE_USER_EMAIL_ALREADY_EXISTS": {"summary": "A user with this email already exists.", "value": {"detail": "UPDATE_USER_EMAIL_ALREADY_EXISTS"}}, "UPDATE_USER_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "UPDATE_USER_INVALID_PASSWORD", "reason": "Password should beat least 3 characters"}}}}, "schema": {"$ref": "#/components/schemas/ErrorModel"}}}, "description": "Bad Request"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["users"], "summary": "Users:Delete User", "operationId": "users_delete_user_users__id__delete", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "responses": {"204": {"description": "Successful Response"}, "401": {"description": "Missing token or inactive user."}, "403": {"description": "Not a superuser."}, "404": {"description": "The user does not exist."}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/login": {"post": {"tags": ["auth"], "summary": "Auth:Cookie.Login", "operationId": "auth_cookie_login_auth_login_post", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Body_auth_cookie_login_auth_login_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"LOGIN_BAD_CREDENTIALS": {"summary": "Bad credentials or the user is inactive.", "value": {"detail": "LOGIN_BAD_CREDENTIALS"}}, "LOGIN_USER_NOT_VERIFIED": {"summary": "The user is not verified.", "value": {"detail": "LOGIN_USER_NOT_VERIFIED"}}}}}}, "204": {"description": "No Content"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/logout": {"post": {"tags": ["auth"], "summary": "Auth:Cookie.Logout", "operationId": "auth_cookie_logout_auth_logout_post", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "401": {"description": "Missing token or inactive user."}, "204": {"description": "No Content"}}, "security": [{"APIKeyCookie": []}]}}, "/auth/register": {"post": {"tags": ["auth"], "summary": "Register:Register", "operationId": "register_register_auth_register_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserCreate"}}}, "required": true}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"REGISTER_USER_ALREADY_EXISTS": {"summary": "A user with this email already exists.", "value": {"detail": "REGISTER_USER_ALREADY_EXISTS"}}, "REGISTER_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "REGISTER_INVALID_PASSWORD", "reason": "Password should beat least 3 characters"}}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/forgot-password": {"post": {"tags": ["auth"], "summary": "Reset:Forgot Password", "operationId": "reset_forgot_password_auth_forgot_password_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_reset_forgot_password_auth_forgot_password_post"}}}, "required": true}, "responses": {"202": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/reset-password": {"post": {"tags": ["auth"], "summary": "Reset:Reset Password", "operationId": "reset_reset_password_auth_reset_password_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_reset_reset_password_auth_reset_password_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"RESET_PASSWORD_BAD_TOKEN": {"summary": "Bad or expired token.", "value": {"detail": "RESET_PASSWORD_BAD_TOKEN"}}, "RESET_PASSWORD_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "RESET_PASSWORD_INVALID_PASSWORD", "reason": "Password should be at least 3 characters"}}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/request-verify-token": {"post": {"tags": ["auth"], "summary": "Verify:Request-Token", "operationId": "verify_request_token_auth_request_verify_token_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_verify_request_token_auth_request_verify_token_post"}}}, "required": true}, "responses": {"202": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/verify": {"post": {"tags": ["auth"], "summary": "Verify:Verify", "operationId": "verify_verify_auth_verify_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_verify_verify_auth_verify_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"VERIFY_USER_BAD_TOKEN": {"summary": "Bad token, not existing user ornot the e-mail currently set for the user.", "value": {"detail": "VERIFY_USER_BAD_TOKEN"}}, "VERIFY_USER_ALREADY_VERIFIED": {"summary": "The user is already verified.", "value": {"detail": "VERIFY_USER_ALREADY_VERIFIED"}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/research/auth/": {"get": {"tags": ["research"], "summary": "Auth", "operationId": "auth_research_auth__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"APIKeyCookie": []}]}}}, "components": {"schemas": {"Body_auth_cookie_login_auth_login_post": {"properties": {"grant_type": {"anyOf": [{"type": "string", "pattern": "password"}, {"type": "null"}], "title": "Grant Type"}, "username": {"type": "string", "title": "Username"}, "password": {"type": "string", "title": "Password"}, "scope": {"type": "string", "title": "Scope", "default": ""}, "client_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}, "client_secret": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Secret"}}, "type": "object", "required": ["username", "password"], "title": "Body_auth_cookie_login_auth_login_post"}, "Body_reset_forgot_password_auth_forgot_password_post": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}}, "type": "object", "required": ["email"], "title": "Body_reset_forgot_password_auth_forgot_password_post"}, "Body_reset_reset_password_auth_reset_password_post": {"properties": {"token": {"type": "string", "title": "Token"}, "password": {"type": "string", "title": "Password"}}, "type": "object", "required": ["token", "password"], "title": "Body_reset_reset_password_auth_reset_password_post"}, "Body_upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put": {"properties": {"file": {"type": "string", "format": "binary", "title": "File"}}, "type": "object", "required": ["file"], "title": "Body_upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put"}, "Body_upload_milestone_image_admin_milestone_images__milestone_id__post": {"properties": {"file": {"type": "string", "format": "binary", "title": "File"}}, "type": "object", "required": ["file"], "title": "Body_upload_milestone_image_admin_milestone_images__milestone_id__post"}, "Body_verify_request_token_auth_request_verify_token_post": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}}, "type": "object", "required": ["email"], "title": "Body_verify_request_token_auth_request_verify_token_post"}, "Body_verify_verify_auth_verify_post": {"properties": {"token": {"type": "string", "title": "Token"}}, "type": "object", "required": ["token"], "title": "Body_verify_verify_auth_verify_post"}, "ErrorModel": {"properties": {"detail": {"anyOf": [{"type": "string"}, {"additionalProperties": {"type": "string"}, "type": "object"}], "title": "Detail"}}, "type": "object", "required": ["detail"], "title": "ErrorModel"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "Language": {"properties": {"id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Id"}, "lang": {"type": "string", "maxLength": 2, "title": "Lang"}}, "type": "object", "required": ["lang"], "title": "Language"}, "LanguageCreate": {"properties": {"lang": {"type": "string", "maxLength": 2, "title": "Lang"}}, "type": "object", "required": ["lang"], "title": "LanguageCreate"}, "MilestoneAdmin": {"properties": {"id": {"type": "integer", "title": "Id"}, "group_id": {"type": "integer", "title": "Group Id"}, "order": {"type": "integer", "title": "Order"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneText"}, "type": "object", "title": "Text", "default": {}}, "images": {"items": {"$ref": "#/components/schemas/MilestoneImage"}, "type": "array", "title": "Images", "default": []}}, "type": "object", "required": ["id", "group_id", "order"], "title": "MilestoneAdmin"}, "MilestoneGroupAdmin-Input": {"properties": {"id": {"type": "integer", "title": "Id"}, "order": {"type": "integer", "title": "Order"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupText"}, "type": "object", "title": "Text", "default": {}}, "milestones": {"items": {"$ref": "#/components/schemas/MilestoneAdmin"}, "type": "array", "title": "Milestones", "default": []}}, "type": "object", "required": ["id", "order"], "title": "MilestoneGroupAdmin"}, "MilestoneGroupAdmin-Output": {"properties": {"id": {"type": "integer", "title": "Id"}, "order": {"type": "integer", "title": "Order"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupText"}, "type": "object", "title": "Text", "default": {}}, "milestones": {"items": {"$ref": "#/components/schemas/MilestoneAdmin"}, "type": "array", "title": "Milestones", "default": []}}, "type": "object", "required": ["id", "order"], "title": "MilestoneGroupAdmin"}, "MilestoneGroupPublic": {"properties": {"id": {"type": "integer", "title": "Id"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupTextPublic"}, "type": "object", "title": "Text", "default": {}}, "milestones": {"items": {"$ref": "#/components/schemas/MilestonePublic"}, "type": "array", "title": "Milestones", "default": []}}, "type": "object", "required": ["id"], "title": "MilestoneGroupPublic"}, "MilestoneGroupText": {"properties": {"title": {"type": "string", "title": "Title", "default": ""}, "desc": {"type": "string", "title": "Desc", "default": ""}, "group_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Group Id"}, "lang_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Lang Id"}}, "type": "object", "title": "MilestoneGroupText"}, "MilestoneGroupTextPublic": {"properties": {"title": {"type": "string", "title": "Title", "default": ""}, "desc": {"type": "string", "title": "Desc", "default": ""}}, "type": "object", "title": "MilestoneGroupTextPublic"}, "MilestoneImage": {"properties": {"id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Id"}, "milestone_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Milestone Id"}, "filename": {"type": "string", "title": "Filename", "default": ""}, "approved": {"type": "boolean", "title": "Approved", "default": false}}, "type": "object", "title": "MilestoneImage"}, "MilestoneImagePublic": {"properties": {"filename": {"type": "string", "title": "Filename"}, "approved": {"type": "boolean", "title": "Approved"}}, "type": "object", "required": ["filename", "approved"], "title": "MilestoneImagePublic"}, "MilestonePublic": {"properties": {"id": {"type": "integer", "title": "Id"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupTextPublic"}, "type": "object", "title": "Text", "default": {}}, "images": {"items": {"$ref": "#/components/schemas/MilestoneImagePublic"}, "type": "array", "title": "Images", "default": []}}, "type": "object", "required": ["id"], "title": "MilestonePublic"}, "MilestoneText": {"properties": {"title": {"type": "string", "title": "Title", "default": ""}, "desc": {"type": "string", "title": "Desc", "default": ""}, "obs": {"type": "string", "title": "Obs", "default": ""}, "help": {"type": "string", "title": "Help", "default": ""}, "milestone_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Milestone Id"}, "lang_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Lang Id"}}, "type": "object", "title": "MilestoneText"}, "UserCreate": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}, "password": {"type": "string", "title": "Password"}, "is_active": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Active", "default": true}, "is_superuser": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Superuser", "default": false}, "is_verified": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Verified", "default": false}, "is_researcher": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Researcher", "default": false}}, "type": "object", "required": ["email", "password"], "title": "UserCreate"}, "UserRead": {"properties": {"id": {"type": "integer", "title": "Id"}, "email": {"type": "string", "format": "email", "title": "Email"}, "is_active": {"type": "boolean", "title": "Is Active", "default": true}, "is_superuser": {"type": "boolean", "title": "Is Superuser", "default": false}, "is_verified": {"type": "boolean", "title": "Is Verified", "default": false}, "is_researcher": {"type": "boolean", "title": "Is Researcher"}}, "type": "object", "required": ["id", "email", "is_researcher"], "title": "UserRead"}, "UserUpdate": {"properties": {"password": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Password"}, "email": {"anyOf": [{"type": "string", "format": "email"}, {"type": "null"}], "title": "Email"}, "is_active": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Active"}, "is_superuser": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Superuser"}, "is_verified": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Verified"}, "is_researcher": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Researcher"}}, "type": "object", "title": "UserUpdate"}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}}, "securitySchemes": {"APIKeyCookie": {"type": "apiKey", "in": "cookie", "name": "fastapiusersauth"}}}} \ No newline at end of file +{"openapi": "3.1.0", "info": {"title": "MONDEY API", "version": "0.1.0"}, "paths": {"/languages/": {"get": {"tags": ["milestones"], "summary": "Get Languages", "operationId": "get_languages", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Response Get Languages Languages Get"}}}}}}}, "/milestones/": {"get": {"tags": ["milestones"], "summary": "Get Milestones", "operationId": "get_milestones", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/MilestonePublic"}, "type": "array", "title": "Response Get Milestones Milestones Get"}}}}}}}, "/milestones/{milestone_id}": {"get": {"tags": ["milestones"], "summary": "Get Milestone", "operationId": "get_milestone", "parameters": [{"name": "milestone_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestonePublic"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/milestone-groups/": {"get": {"tags": ["milestones"], "summary": "Get Milestone Groups", "operationId": "get_milestone_groups", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/MilestoneGroupPublic"}, "type": "array", "title": "Response Get Milestone Groups Milestone Groups Get"}}}}}}}, "/milestone-groups/{milestone_group_id}": {"get": {"tags": ["milestones"], "summary": "Get Milestone Group", "operationId": "get_milestone_group", "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupPublic"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/user-questions/": {"get": {"tags": ["questions"], "summary": "Get User Questions", "operationId": "get_user_questions", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/UserQuestionPublic"}, "type": "array", "title": "Response Get User Questions User Questions Get"}}}}}}}, "/admin/languages/": {"post": {"tags": ["admin"], "summary": "Create Language", "operationId": "create_language", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/LanguageCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Language"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/languages/{language_id}": {"delete": {"tags": ["admin"], "summary": "Delete Language", "operationId": "delete_language", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "language_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Language Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestone-groups/": {"get": {"tags": ["admin"], "summary": "Get Milestone Groups Admin", "operationId": "get_milestone_groups_admin", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Output"}, "type": "array", "title": "Response Get Milestone Groups Admin Admin Milestone Groups Get"}}}}}, "security": [{"APIKeyCookie": []}]}, "post": {"tags": ["admin"], "summary": "Create Milestone Group Admin", "operationId": "create_milestone_group_admin", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Output"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/milestone-groups": {"put": {"tags": ["admin"], "summary": "Update Milestone Group Admin", "operationId": "update_milestone_group_admin", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Input"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneGroupAdmin-Output"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/milestone-groups/{milestone_group_id}": {"delete": {"tags": ["admin"], "summary": "Delete Milestone Group Admin", "operationId": "delete_milestone_group_admin", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestone-group-images/{milestone_group_id}": {"put": {"tags": ["admin"], "summary": "Upload Milestone Group Image", "operationId": "upload_milestone_group_image", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestones/{milestone_group_id}": {"post": {"tags": ["admin"], "summary": "Create Milestone", "operationId": "create_milestone", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_group_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Group Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneAdmin"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestones/": {"put": {"tags": ["admin"], "summary": "Update Milestone", "operationId": "update_milestone", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneAdmin"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneAdmin"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/milestones/{milestone_id}": {"delete": {"tags": ["admin"], "summary": "Delete Milestone", "operationId": "delete_milestone", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/milestone-images/{milestone_id}": {"post": {"tags": ["admin"], "summary": "Upload Milestone Image", "operationId": "upload_milestone_image", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "milestone_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Milestone Id"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_upload_milestone_image_admin_milestone_images__milestone_id__post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MilestoneImage"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/user-questions/": {"get": {"tags": ["admin"], "summary": "Get User Questions", "operationId": "get_user_questions", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/UserQuestionAdmin"}, "type": "array", "title": "Response Get User Questions Admin User Questions Get"}}}}}, "security": [{"APIKeyCookie": []}]}, "put": {"tags": ["admin"], "summary": "Update User Question", "operationId": "update_user_question", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserQuestionAdmin"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserQuestionAdmin"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}, "post": {"tags": ["admin"], "summary": "Create User Question", "operationId": "create_user_question", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserQuestionAdmin"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/admin/user-questions/{user_question_id}": {"delete": {"tags": ["admin"], "summary": "Delete Question", "operationId": "delete_question", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "user_question_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "User Question Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/users/me": {"get": {"tags": ["users"], "summary": "Users:Current User", "operationId": "users:current_user", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}}, "security": [{"APIKeyCookie": []}]}, "patch": {"tags": ["users"], "summary": "Users:Patch Current User", "operationId": "users:patch_current_user", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserUpdate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"UPDATE_USER_EMAIL_ALREADY_EXISTS": {"summary": "A user with this email already exists.", "value": {"detail": "UPDATE_USER_EMAIL_ALREADY_EXISTS"}}, "UPDATE_USER_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "UPDATE_USER_INVALID_PASSWORD", "reason": "Password should beat least 3 characters"}}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"APIKeyCookie": []}]}}, "/users/{id}": {"get": {"tags": ["users"], "summary": "Users:User", "operationId": "users:user", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}, "403": {"description": "Not a superuser."}, "404": {"description": "The user does not exist."}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "patch": {"tags": ["users"], "summary": "Users:Patch User", "operationId": "users:patch_user", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserUpdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "401": {"description": "Missing token or inactive user."}, "403": {"description": "Not a superuser."}, "404": {"description": "The user does not exist."}, "400": {"content": {"application/json": {"examples": {"UPDATE_USER_EMAIL_ALREADY_EXISTS": {"summary": "A user with this email already exists.", "value": {"detail": "UPDATE_USER_EMAIL_ALREADY_EXISTS"}}, "UPDATE_USER_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "UPDATE_USER_INVALID_PASSWORD", "reason": "Password should beat least 3 characters"}}}}, "schema": {"$ref": "#/components/schemas/ErrorModel"}}}, "description": "Bad Request"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["users"], "summary": "Users:Delete User", "operationId": "users:delete_user", "security": [{"APIKeyCookie": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "title": "Id"}}], "responses": {"204": {"description": "Successful Response"}, "401": {"description": "Missing token or inactive user."}, "403": {"description": "Not a superuser."}, "404": {"description": "The user does not exist."}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/login": {"post": {"tags": ["auth"], "summary": "Auth:Cookie.Login", "operationId": "auth:cookie.login", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Body_auth_cookie_login_auth_login_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"LOGIN_BAD_CREDENTIALS": {"summary": "Bad credentials or the user is inactive.", "value": {"detail": "LOGIN_BAD_CREDENTIALS"}}, "LOGIN_USER_NOT_VERIFIED": {"summary": "The user is not verified.", "value": {"detail": "LOGIN_USER_NOT_VERIFIED"}}}}}}, "204": {"description": "No Content"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/logout": {"post": {"tags": ["auth"], "summary": "Auth:Cookie.Logout", "operationId": "auth:cookie.logout", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "401": {"description": "Missing token or inactive user."}, "204": {"description": "No Content"}}, "security": [{"APIKeyCookie": []}]}}, "/auth/register": {"post": {"tags": ["auth"], "summary": "Register:Register", "operationId": "register:register", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserCreate"}}}, "required": true}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"REGISTER_USER_ALREADY_EXISTS": {"summary": "A user with this email already exists.", "value": {"detail": "REGISTER_USER_ALREADY_EXISTS"}}, "REGISTER_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "REGISTER_INVALID_PASSWORD", "reason": "Password should beat least 3 characters"}}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/forgot-password": {"post": {"tags": ["auth"], "summary": "Reset:Forgot Password", "operationId": "reset:forgot_password", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_reset_forgot_password_auth_forgot_password_post"}}}, "required": true}, "responses": {"202": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/reset-password": {"post": {"tags": ["auth"], "summary": "Reset:Reset Password", "operationId": "reset:reset_password", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_reset_reset_password_auth_reset_password_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"RESET_PASSWORD_BAD_TOKEN": {"summary": "Bad or expired token.", "value": {"detail": "RESET_PASSWORD_BAD_TOKEN"}}, "RESET_PASSWORD_INVALID_PASSWORD": {"summary": "Password validation failed.", "value": {"detail": {"code": "RESET_PASSWORD_INVALID_PASSWORD", "reason": "Password should be at least 3 characters"}}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/request-verify-token": {"post": {"tags": ["auth"], "summary": "Verify:Request-Token", "operationId": "verify:request-token", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_verify_request_token_auth_request_verify_token_post"}}}, "required": true}, "responses": {"202": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/auth/verify": {"post": {"tags": ["auth"], "summary": "Verify:Verify", "operationId": "verify:verify", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_verify_verify_auth_verify_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserRead"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorModel"}, "examples": {"VERIFY_USER_BAD_TOKEN": {"summary": "Bad token, not existing user ornot the e-mail currently set for the user.", "value": {"detail": "VERIFY_USER_BAD_TOKEN"}}, "VERIFY_USER_ALREADY_VERIFIED": {"summary": "The user is already verified.", "value": {"detail": "VERIFY_USER_ALREADY_VERIFIED"}}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/research/auth/": {"get": {"tags": ["research"], "summary": "Auth", "operationId": "auth", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"APIKeyCookie": []}]}}}, "components": {"schemas": {"Body_auth_cookie_login_auth_login_post": {"properties": {"grant_type": {"anyOf": [{"type": "string", "pattern": "password"}, {"type": "null"}], "title": "Grant Type"}, "username": {"type": "string", "title": "Username"}, "password": {"type": "string", "title": "Password"}, "scope": {"type": "string", "title": "Scope", "default": ""}, "client_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Id"}, "client_secret": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Secret"}}, "type": "object", "required": ["username", "password"], "title": "Body_auth_cookie_login_auth_login_post"}, "Body_reset_forgot_password_auth_forgot_password_post": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}}, "type": "object", "required": ["email"], "title": "Body_reset_forgot_password_auth_forgot_password_post"}, "Body_reset_reset_password_auth_reset_password_post": {"properties": {"token": {"type": "string", "title": "Token"}, "password": {"type": "string", "title": "Password"}}, "type": "object", "required": ["token", "password"], "title": "Body_reset_reset_password_auth_reset_password_post"}, "Body_upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put": {"properties": {"file": {"type": "string", "format": "binary", "title": "File"}}, "type": "object", "required": ["file"], "title": "Body_upload_milestone_group_image_admin_milestone_group_images__milestone_group_id__put"}, "Body_upload_milestone_image_admin_milestone_images__milestone_id__post": {"properties": {"file": {"type": "string", "format": "binary", "title": "File"}}, "type": "object", "required": ["file"], "title": "Body_upload_milestone_image_admin_milestone_images__milestone_id__post"}, "Body_verify_request_token_auth_request_verify_token_post": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}}, "type": "object", "required": ["email"], "title": "Body_verify_request_token_auth_request_verify_token_post"}, "Body_verify_verify_auth_verify_post": {"properties": {"token": {"type": "string", "title": "Token"}}, "type": "object", "required": ["token"], "title": "Body_verify_verify_auth_verify_post"}, "ErrorModel": {"properties": {"detail": {"anyOf": [{"type": "string"}, {"additionalProperties": {"type": "string"}, "type": "object"}], "title": "Detail"}}, "type": "object", "required": ["detail"], "title": "ErrorModel"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "Language": {"properties": {"id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Id"}, "lang": {"type": "string", "maxLength": 2, "title": "Lang"}}, "type": "object", "required": ["lang"], "title": "Language"}, "LanguageCreate": {"properties": {"lang": {"type": "string", "maxLength": 2, "title": "Lang"}}, "type": "object", "required": ["lang"], "title": "LanguageCreate"}, "MilestoneAdmin": {"properties": {"id": {"type": "integer", "title": "Id"}, "group_id": {"type": "integer", "title": "Group Id"}, "order": {"type": "integer", "title": "Order"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneText"}, "type": "object", "title": "Text", "default": {}}, "images": {"items": {"$ref": "#/components/schemas/MilestoneImage"}, "type": "array", "title": "Images", "default": []}}, "type": "object", "required": ["id", "group_id", "order"], "title": "MilestoneAdmin"}, "MilestoneGroupAdmin-Input": {"properties": {"id": {"type": "integer", "title": "Id"}, "order": {"type": "integer", "title": "Order"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupText"}, "type": "object", "title": "Text", "default": {}}, "milestones": {"items": {"$ref": "#/components/schemas/MilestoneAdmin"}, "type": "array", "title": "Milestones", "default": []}}, "type": "object", "required": ["id", "order"], "title": "MilestoneGroupAdmin"}, "MilestoneGroupAdmin-Output": {"properties": {"id": {"type": "integer", "title": "Id"}, "order": {"type": "integer", "title": "Order"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupText"}, "type": "object", "title": "Text", "default": {}}, "milestones": {"items": {"$ref": "#/components/schemas/MilestoneAdmin"}, "type": "array", "title": "Milestones", "default": []}}, "type": "object", "required": ["id", "order"], "title": "MilestoneGroupAdmin"}, "MilestoneGroupPublic": {"properties": {"id": {"type": "integer", "title": "Id"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupTextPublic"}, "type": "object", "title": "Text", "default": {}}, "milestones": {"items": {"$ref": "#/components/schemas/MilestonePublic"}, "type": "array", "title": "Milestones", "default": []}}, "type": "object", "required": ["id"], "title": "MilestoneGroupPublic"}, "MilestoneGroupText": {"properties": {"title": {"type": "string", "title": "Title", "default": ""}, "desc": {"type": "string", "title": "Desc", "default": ""}, "group_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Group Id"}, "lang_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Lang Id"}}, "type": "object", "title": "MilestoneGroupText"}, "MilestoneGroupTextPublic": {"properties": {"title": {"type": "string", "title": "Title", "default": ""}, "desc": {"type": "string", "title": "Desc", "default": ""}}, "type": "object", "title": "MilestoneGroupTextPublic"}, "MilestoneImage": {"properties": {"id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Id"}, "milestone_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Milestone Id"}, "filename": {"type": "string", "title": "Filename", "default": ""}, "approved": {"type": "boolean", "title": "Approved", "default": false}}, "type": "object", "title": "MilestoneImage"}, "MilestoneImagePublic": {"properties": {"filename": {"type": "string", "title": "Filename"}, "approved": {"type": "boolean", "title": "Approved"}}, "type": "object", "required": ["filename", "approved"], "title": "MilestoneImagePublic"}, "MilestonePublic": {"properties": {"id": {"type": "integer", "title": "Id"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/MilestoneGroupTextPublic"}, "type": "object", "title": "Text", "default": {}}, "images": {"items": {"$ref": "#/components/schemas/MilestoneImagePublic"}, "type": "array", "title": "Images", "default": []}}, "type": "object", "required": ["id"], "title": "MilestonePublic"}, "MilestoneText": {"properties": {"title": {"type": "string", "title": "Title", "default": ""}, "desc": {"type": "string", "title": "Desc", "default": ""}, "obs": {"type": "string", "title": "Obs", "default": ""}, "help": {"type": "string", "title": "Help", "default": ""}, "milestone_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Milestone Id"}, "lang_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Lang Id"}}, "type": "object", "title": "MilestoneText"}, "UserCreate": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}, "password": {"type": "string", "title": "Password"}, "is_active": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Active", "default": true}, "is_superuser": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Superuser", "default": false}, "is_verified": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Verified", "default": false}, "is_researcher": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Researcher", "default": false}}, "type": "object", "required": ["email", "password"], "title": "UserCreate"}, "UserQuestionAdmin": {"properties": {"id": {"type": "integer", "title": "Id"}, "order": {"type": "integer", "title": "Order"}, "input": {"type": "string", "title": "Input"}, "options": {"type": "string", "title": "Options"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/UserQuestionText"}, "type": "object", "title": "Text", "default": {}}}, "type": "object", "required": ["id", "order", "input", "options"], "title": "UserQuestionAdmin"}, "UserQuestionPublic": {"properties": {"id": {"type": "integer", "title": "Id"}, "input": {"type": "string", "title": "Input"}, "text": {"additionalProperties": {"$ref": "#/components/schemas/UserQuestionTextPublic"}, "type": "object", "title": "Text", "default": {}}}, "type": "object", "required": ["id", "input"], "title": "UserQuestionPublic"}, "UserQuestionText": {"properties": {"question": {"type": "string", "title": "Question", "default": ""}, "options_json": {"type": "string", "title": "Options Json", "default": ""}, "user_question_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "User Question Id"}, "lang_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Lang Id"}, "options": {"type": "string", "title": "Options", "default": ""}}, "type": "object", "title": "UserQuestionText"}, "UserQuestionTextPublic": {"properties": {"question": {"type": "string", "title": "Question", "default": ""}, "options_json": {"type": "string", "title": "Options Json", "default": ""}}, "type": "object", "title": "UserQuestionTextPublic"}, "UserRead": {"properties": {"id": {"type": "integer", "title": "Id"}, "email": {"type": "string", "format": "email", "title": "Email"}, "is_active": {"type": "boolean", "title": "Is Active", "default": true}, "is_superuser": {"type": "boolean", "title": "Is Superuser", "default": false}, "is_verified": {"type": "boolean", "title": "Is Verified", "default": false}, "is_researcher": {"type": "boolean", "title": "Is Researcher"}}, "type": "object", "required": ["id", "email", "is_researcher"], "title": "UserRead"}, "UserUpdate": {"properties": {"password": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Password"}, "email": {"anyOf": [{"type": "string", "format": "email"}, {"type": "null"}], "title": "Email"}, "is_active": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Active"}, "is_superuser": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Superuser"}, "is_verified": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Verified"}, "is_researcher": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Researcher"}}, "type": "object", "title": "UserUpdate"}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}}, "securitySchemes": {"APIKeyCookie": {"type": "apiKey", "in": "cookie", "name": "fastapiusersauth"}}}} \ No newline at end of file diff --git a/mondey_backend/src/mondey_backend/export.py b/mondey_backend/src/mondey_backend/export.py index 5135b67e..34e42f89 100644 --- a/mondey_backend/src/mondey_backend/export.py +++ b/mondey_backend/src/mondey_backend/export.py @@ -4,6 +4,7 @@ import click from fastapi.openapi.utils import get_openapi +from fastapi.routing import APIRoute from .main import create_app @@ -13,6 +14,10 @@ def export_openapi_json(filename: str) -> None: app = create_app() click.echo(f"Exporting MONDEY OpenAPI spec to {filename}...", nl=False) + # simplify route names to get less redundantly verbose API function names + for route in app.routes: + if isinstance(route, APIRoute): + route.operation_id = route.name with open(filename, "w") as f: json.dump( get_openapi( diff --git a/mondey_backend/src/mondey_backend/routers/admin.py b/mondey_backend/src/mondey_backend/routers/admin.py index 585359d4..6d20a172 100644 --- a/mondey_backend/src/mondey_backend/routers/admin.py +++ b/mondey_backend/src/mondey_backend/routers/admin.py @@ -45,14 +45,14 @@ def delete_language(session: SessionDep, language_id: int): return {"ok": True} @router.get("/milestone-groups/", response_model=list[MilestoneGroupAdmin]) - def get_milestone_groups(session: SessionDep): + def get_milestone_groups_admin(session: SessionDep): milestone_groups = session.exec( select(MilestoneGroup).order_by(col(MilestoneGroup.order)) ).all() return milestone_groups @router.post("/milestone-groups/", response_model=MilestoneGroupAdmin) - def create_milestone_group(session: SessionDep): + def create_milestone_group_admin(session: SessionDep): db_milestone_group = MilestoneGroup() add(session, db_milestone_group) for language in session.exec(select(Language)).all(): @@ -63,8 +63,8 @@ def create_milestone_group(session: SessionDep): session.refresh(db_milestone_group) return db_milestone_group - @router.put("/milestone-groups/", response_model=MilestoneGroupAdmin) - def update_milestone_group( + @router.put("/milestone-groups", response_model=MilestoneGroupAdmin) + def update_milestone_group_admin( session: SessionDep, milestone_group: MilestoneGroupAdmin, ): @@ -78,7 +78,7 @@ def update_milestone_group( return db_milestone_group @router.delete("/milestone-groups/{milestone_group_id}") - def delete_milestone_group(session: SessionDep, milestone_group_id: int): + def delete_milestone_group_admin(session: SessionDep, milestone_group_id: int): milestone_group = get(session, MilestoneGroup, milestone_group_id) session.delete(milestone_group) session.commit()