Skip to content

Commit accd07a

Browse files
Merge branch 'backend-api-2' of https://github.com/monicasmith463/study-assistant into backend-api-2
2 parents f86ade3 + 728f908 commit accd07a

File tree

3 files changed

+248
-1
lines changed

3 files changed

+248
-1
lines changed

frontend/src/client/schemas.gen.ts

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
export const AnswerUpdateSchema = {
4+
properties: {
5+
id: {
6+
type: 'string',
7+
format: 'uuid',
8+
title: 'Id'
9+
},
10+
response: {
11+
type: 'string',
12+
title: 'Response'
13+
}
14+
},
15+
type: 'object',
16+
required: ['id', 'response'],
17+
title: 'AnswerUpdate'
18+
} as const;
19+
320
export const Body_documents_create_documentSchema = {
421
properties: {
522
file: {
@@ -234,6 +251,123 @@ export const DocumentsPublicSchema = {
234251
title: 'DocumentsPublic'
235252
} as const;
236253

254+
export const ExamAttemptCreateSchema = {
255+
properties: {
256+
score: {
257+
anyOf: [
258+
{
259+
type: 'number'
260+
},
261+
{
262+
type: 'null'
263+
}
264+
],
265+
title: 'Score'
266+
},
267+
is_complete: {
268+
type: 'boolean',
269+
title: 'Is Complete',
270+
default: false
271+
},
272+
exam_id: {
273+
type: 'string',
274+
format: 'uuid',
275+
title: 'Exam Id'
276+
}
277+
},
278+
type: 'object',
279+
required: ['exam_id'],
280+
title: 'ExamAttemptCreate'
281+
} as const;
282+
283+
export const ExamAttemptPublicSchema = {
284+
properties: {
285+
score: {
286+
anyOf: [
287+
{
288+
type: 'number'
289+
},
290+
{
291+
type: 'null'
292+
}
293+
],
294+
title: 'Score'
295+
},
296+
is_complete: {
297+
type: 'boolean',
298+
title: 'Is Complete',
299+
default: false
300+
},
301+
id: {
302+
type: 'string',
303+
format: 'uuid',
304+
title: 'Id'
305+
},
306+
exam_id: {
307+
type: 'string',
308+
format: 'uuid',
309+
title: 'Exam Id'
310+
},
311+
completed_at: {
312+
anyOf: [
313+
{
314+
type: 'string',
315+
format: 'date-time'
316+
},
317+
{
318+
type: 'null'
319+
}
320+
],
321+
title: 'Completed At'
322+
},
323+
created_at: {
324+
type: 'string',
325+
format: 'date-time',
326+
title: 'Created At'
327+
},
328+
updated_at: {
329+
type: 'string',
330+
format: 'date-time',
331+
title: 'Updated At'
332+
}
333+
},
334+
type: 'object',
335+
required: ['id', 'exam_id', 'created_at', 'updated_at'],
336+
title: 'ExamAttemptPublic'
337+
} as const;
338+
339+
export const ExamAttemptUpdateSchema = {
340+
properties: {
341+
is_complete: {
342+
anyOf: [
343+
{
344+
type: 'boolean'
345+
},
346+
{
347+
type: 'null'
348+
}
349+
],
350+
title: 'Is Complete'
351+
},
352+
answers: {
353+
anyOf: [
354+
{
355+
items: {
356+
'$ref': '#/components/schemas/AnswerUpdate'
357+
},
358+
type: 'array'
359+
},
360+
{
361+
type: 'null'
362+
}
363+
],
364+
title: 'Answers'
365+
}
366+
},
367+
type: 'object',
368+
title: 'ExamAttemptUpdate'
369+
} as const;
370+
237371
export const ExamPublicSchema = {
238372
properties: {
239373
title: {

frontend/src/client/sdk.gen.ts

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import type { CancelablePromise } from './core/CancelablePromise';
44
import { OpenAPI } from './core/OpenAPI';
55
import { request as __request } from './core/request';
6-
import type { DocumentsCreateDocumentData, DocumentsCreateDocumentResponse, DocumentsReadDocumentsData, DocumentsReadDocumentsResponse, DocumentsReadDocumentData, DocumentsReadDocumentResponse, DocumentsUpdateDocumentData, DocumentsUpdateDocumentResponse, DocumentsDeleteDocumentData, DocumentsDeleteDocumentResponse, ExamsGenerateExamData, ExamsGenerateExamResponse, ExamsReadExamData, ExamsReadExamResponse, ExamsUpdateExamData, ExamsUpdateExamResponse, ExamsDeleteExamData, ExamsDeleteExamResponse, ExamsReadExamsData, ExamsReadExamsResponse, ItemsReadItemsData, ItemsReadItemsResponse, ItemsCreateItemData, ItemsCreateItemResponse, ItemsReadItemData, ItemsReadItemResponse, ItemsUpdateItemData, ItemsUpdateItemResponse, ItemsDeleteItemData, ItemsDeleteItemResponse, LoginLoginAccessTokenData, LoginLoginAccessTokenResponse, LoginTestTokenResponse, LoginRecoverPasswordData, LoginRecoverPasswordResponse, LoginResetPasswordData, LoginResetPasswordResponse, LoginRecoverPasswordHtmlContentData, LoginRecoverPasswordHtmlContentResponse, PrivateCreateUserData, PrivateCreateUserResponse, UsersReadUsersData, UsersReadUsersResponse, UsersCreateUserData, UsersCreateUserResponse, UsersReadUserMeResponse, UsersDeleteUserMeResponse, UsersUpdateUserMeData, UsersUpdateUserMeResponse, UsersUpdatePasswordMeData, UsersUpdatePasswordMeResponse, UsersRegisterUserData, UsersRegisterUserResponse, UsersReadUserByIdData, UsersReadUserByIdResponse, UsersUpdateUserData, UsersUpdateUserResponse, UsersDeleteUserData, UsersDeleteUserResponse, UtilsTestEmailData, UtilsTestEmailResponse, UtilsHealthCheckResponse } from './types.gen';
6+
import type { DocumentsCreateDocumentData, DocumentsCreateDocumentResponse, DocumentsReadDocumentsData, DocumentsReadDocumentsResponse, DocumentsReadDocumentData, DocumentsReadDocumentResponse, DocumentsUpdateDocumentData, DocumentsUpdateDocumentResponse, DocumentsDeleteDocumentData, DocumentsDeleteDocumentResponse, ExamAttemptsCreateExamAttemptData, ExamAttemptsCreateExamAttemptResponse, ExamAttemptsReadExamAttemptData, ExamAttemptsReadExamAttemptResponse, ExamAttemptsUpdateExamAttemptData, ExamAttemptsUpdateExamAttemptResponse, ExamsGenerateExamData, ExamsGenerateExamResponse, ExamsReadExamData, ExamsReadExamResponse, ExamsUpdateExamData, ExamsUpdateExamResponse, ExamsDeleteExamData, ExamsDeleteExamResponse, ExamsReadExamsData, ExamsReadExamsResponse, ItemsReadItemsData, ItemsReadItemsResponse, ItemsCreateItemData, ItemsCreateItemResponse, ItemsReadItemData, ItemsReadItemResponse, ItemsUpdateItemData, ItemsUpdateItemResponse, ItemsDeleteItemData, ItemsDeleteItemResponse, LoginLoginAccessTokenData, LoginLoginAccessTokenResponse, LoginTestTokenResponse, LoginRecoverPasswordData, LoginRecoverPasswordResponse, LoginResetPasswordData, LoginResetPasswordResponse, LoginRecoverPasswordHtmlContentData, LoginRecoverPasswordHtmlContentResponse, PrivateCreateUserData, PrivateCreateUserResponse, UsersReadUsersData, UsersReadUsersResponse, UsersCreateUserData, UsersCreateUserResponse, UsersReadUserMeResponse, UsersDeleteUserMeResponse, UsersUpdateUserMeData, UsersUpdateUserMeResponse, UsersUpdatePasswordMeData, UsersUpdatePasswordMeResponse, UsersRegisterUserData, UsersRegisterUserResponse, UsersReadUserByIdData, UsersReadUserByIdResponse, UsersUpdateUserData, UsersUpdateUserResponse, UsersDeleteUserData, UsersDeleteUserResponse, UtilsTestEmailData, UtilsTestEmailResponse, UtilsHealthCheckResponse } from './types.gen';
77

88
export class DocumentsService {
99
/**
@@ -115,6 +115,74 @@ export class DocumentsService {
115115
}
116116
}
117117

118+
export class ExamAttemptsService {
119+
/**
120+
* Create Exam Attempt
121+
* Create a new exam attempt for a specific exam.
122+
* @param data The data for the request.
123+
* @param data.requestBody
124+
* @returns ExamAttemptPublic Successful Response
125+
* @throws ApiError
126+
*/
127+
public static createExamAttempt(data: ExamAttemptsCreateExamAttemptData): CancelablePromise<ExamAttemptsCreateExamAttemptResponse> {
128+
return __request(OpenAPI, {
129+
method: 'POST',
130+
url: '/api/v1/exam-attempts/',
131+
body: data.requestBody,
132+
mediaType: 'application/json',
133+
errors: {
134+
422: 'Validation Error'
135+
}
136+
});
137+
}
138+
139+
/**
140+
* Read Exam Attempt
141+
* Get ExamAttempt by ID.
142+
* @param data The data for the request.
143+
* @param data.id
144+
* @returns ExamAttemptPublic Successful Response
145+
* @throws ApiError
146+
*/
147+
public static readExamAttempt(data: ExamAttemptsReadExamAttemptData): CancelablePromise<ExamAttemptsReadExamAttemptResponse> {
148+
return __request(OpenAPI, {
149+
method: 'GET',
150+
url: '/api/v1/exam-attempts/{id}',
151+
path: {
152+
id: data.id
153+
},
154+
errors: {
155+
422: 'Validation Error'
156+
}
157+
});
158+
}
159+
160+
/**
161+
* Update Exam Attempt
162+
* Update an exam attempt with answers.
163+
* If `is_complete=True`, compute the score.
164+
* @param data The data for the request.
165+
* @param data.attemptId
166+
* @param data.requestBody
167+
* @returns ExamAttemptPublic Successful Response
168+
* @throws ApiError
169+
*/
170+
public static updateExamAttempt(data: ExamAttemptsUpdateExamAttemptData): CancelablePromise<ExamAttemptsUpdateExamAttemptResponse> {
171+
return __request(OpenAPI, {
172+
method: 'PATCH',
173+
url: '/api/v1/exam-attempts/{attempt_id}',
174+
path: {
175+
attempt_id: data.attemptId
176+
},
177+
body: data.requestBody,
178+
mediaType: 'application/json',
179+
errors: {
180+
422: 'Validation Error'
181+
}
182+
});
183+
}
184+
}
185+
118186
export class ExamsService {
119187
/**
120188
* Generate Exam

frontend/src/client/types.gen.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
export type AnswerUpdate = {
4+
id: string;
5+
response: string;
6+
};
7+
38
export type Body_documents_create_document = {
49
file: (Blob | File);
510
};
@@ -37,6 +42,27 @@ export type DocumentUpdate = {
3742
size?: (number | null);
3843
};
3944

45+
export type ExamAttemptCreate = {
46+
score?: (number | null);
47+
is_complete?: boolean;
48+
exam_id: string;
49+
};
50+
51+
export type ExamAttemptPublic = {
52+
score?: (number | null);
53+
is_complete?: boolean;
54+
id: string;
55+
exam_id: string;
56+
completed_at?: (string | null);
57+
created_at: string;
58+
updated_at: string;
59+
};
60+
61+
export type ExamAttemptUpdate = {
62+
is_complete?: (boolean | null);
63+
answers?: (Array<AnswerUpdate> | null);
64+
};
65+
4066
export type ExamPublic = {
4167
title: string;
4268
description?: (string | null);
@@ -203,6 +229,25 @@ export type DocumentsDeleteDocumentData = {
203229

204230
export type DocumentsDeleteDocumentResponse = (Message);
205231

232+
export type ExamAttemptsCreateExamAttemptData = {
233+
requestBody: ExamAttemptCreate;
234+
};
235+
236+
export type ExamAttemptsCreateExamAttemptResponse = (ExamAttemptPublic);
237+
238+
export type ExamAttemptsReadExamAttemptData = {
239+
id: string;
240+
};
241+
242+
export type ExamAttemptsReadExamAttemptResponse = (ExamAttemptPublic);
243+
244+
export type ExamAttemptsUpdateExamAttemptData = {
245+
attemptId: string;
246+
requestBody: ExamAttemptUpdate;
247+
};
248+
249+
export type ExamAttemptsUpdateExamAttemptResponse = (ExamAttemptPublic);
250+
206251
export type ExamsGenerateExamData = {
207252
requestBody: GenerateQuestionsRequest;
208253
};

0 commit comments

Comments
 (0)