diff --git a/documentation/authDescribers.ts b/documentation/authDescribers.ts index 694b3cd20b93dbbb3654ad19b529e2cc5968d001..472851bc2fd797cac5ab8f460ef64f3600dbaf75 100644 --- a/documentation/authDescribers.ts +++ b/documentation/authDescribers.ts @@ -12,6 +12,10 @@ const signinRoute = describeRoute({ schema: { $ref: '#/components/schemas/AuthInput', // Referência ao schema de autenticação }, + example: { + email: 'client@client.com', + password: '1234mudar', + }, }, }, }, diff --git a/documentation/resourceDescriber.ts b/documentation/resourceDescriber.ts index 5cf529237e99dbab948f4a6b24843b1fdf1f477a..8a6d5bce67b1615daaeb8f7040569feec3ade745 100644 --- a/documentation/resourceDescriber.ts +++ b/documentation/resourceDescriber.ts @@ -1,6 +1,6 @@ import { describeRoute } from 'hono-openapi'; // Descrição da rota /create - const createResourceRoute = describeRoute({ +const createResourceRoute = describeRoute({ method: 'POST', path: '/create', description: 'Create a new resource.', @@ -8,12 +8,57 @@ import { describeRoute } from 'hono-openapi'; requestBody: { content: { 'application/json': { - type: 'object', - properties: { - name: { type: 'string' }, - description: { type: 'string' }, + schema: { + type: 'object', + properties: { + name: { type: 'string' }, + description: { type: 'string' }, + state: { type: 'string' }, + author: { type: 'string' }, + user_id: { type: 'integer' }, + resource_stats_id: { type: 'integer' }, + object_type_id: { type: 'integer' }, + license_id: { type: 'integer' }, + subjects: { + type: 'array', + items: { type: 'integer' }, + }, + language: { + type: 'array', + items: { type: 'integer' }, + }, + educational_stages: { + type: 'array', + items: { type: 'integer' }, + }, + }, + required: [ + 'name', + 'description', + 'state', + 'author', + 'user_id', + 'resource_stats_id', + 'object_type_id', + 'license_id', + 'subjects', + 'language', + 'educational_stages' + ], + }, + example: { + name: 'Sample Resource', + description: 'This is a sample description for the resource.', + state: 'draft', + author: 'nome', + user_id: 1, + resource_stats_id: 1, + object_type_id: 1, + license_id: 1, + subjects: [1, 2], + language: [1], + educational_stages: [1, 2] }, - required: ['name', 'description'], }, }, }, @@ -22,10 +67,12 @@ import { describeRoute } from 'hono-openapi'; description: 'Resource created successfully.', content: { 'application/json': { - type: 'object', - properties: { - resource: { type: 'object' }, - stats: { type: 'object' }, + schema: { + type: 'object', + properties: { + resource: { type: 'object' }, + stats: { type: 'object' }, + }, }, }, }, @@ -34,12 +81,14 @@ import { describeRoute } from 'hono-openapi'; description: 'Failed to create resource.', content: { 'application/json': { - type: 'object', - properties: { - status: { type: 'string' }, - message: { type: 'string' }, - code: { type: 'integer' }, - suggestion: { type: 'string' }, + schema: { + type: 'object', + properties: { + status: { type: 'string' }, + message: { type: 'string' }, + code: { type: 'integer' }, + suggestion: { type: 'string' }, + }, }, }, }, @@ -47,6 +96,7 @@ import { describeRoute } from 'hono-openapi'; }, }); + // Descrição da rota /update const updateResourceRoute = describeRoute({ method: 'POST', diff --git a/src/db/migrations/0000_burly_terror.sql b/src/db/migrations/0000_exotic_spacker_dave.sql similarity index 100% rename from src/db/migrations/0000_burly_terror.sql rename to src/db/migrations/0000_exotic_spacker_dave.sql diff --git a/src/db/migrations/meta/0000_snapshot.json b/src/db/migrations/meta/0000_snapshot.json index bdcaa2707ab38856db52e818b696986f65791dcf..511b50aac096804e0e017343550e61131dc2df80 100644 --- a/src/db/migrations/meta/0000_snapshot.json +++ b/src/db/migrations/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "f2e2d3b9-e896-4124-9747-59bff364742e", + "id": "28b4c785-a533-453b-b856-32e3a709d5ef", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", diff --git a/src/db/migrations/meta/_journal.json b/src/db/migrations/meta/_journal.json index 3fe686dcf7abcf4f284a8e2e48ae5261e21a06c0..2ccd2cf644d65ed415e0d71b2b59f6653440c9c9 100644 --- a/src/db/migrations/meta/_journal.json +++ b/src/db/migrations/meta/_journal.json @@ -5,8 +5,8 @@ { "idx": 0, "version": "7", - "when": 1747750392448, - "tag": "0000_burly_terror", + "when": 1748356191055, + "tag": "0000_exotic_spacker_dave", "breakpoints": true } ] diff --git a/src/documentation/authDescribers.ts b/src/documentation/authDescribers.ts index 91ca7bdb69bb68d333665eaa316fe70e64ebea14..f43cdf0a0c06184e7b569c6fbd2d459ae04a267c 100644 --- a/src/documentation/authDescribers.ts +++ b/src/documentation/authDescribers.ts @@ -12,6 +12,10 @@ const signinRoute = describeRoute({ schema: { $ref: '#/components/schemas/AuthInput', // Referência ao schema de autenticação }, + example: { + email: "client@client.com", + password: "1234mudar" + } }, }, }, @@ -58,6 +62,14 @@ const signupRoute = describeRoute({ schema: { $ref: '#/components/schemas/UserInput', // Referência ao schema de entrada do usuário }, + example: { + name: "user", + username: "username", + password: "senha", + email: "user@user.com", + birthday: "2000-01-01", + cpf: "00000000000" + } }, }, }, @@ -100,7 +112,7 @@ const signupRoute = describeRoute({ const requestPasswordResetRoute = describeRoute({ method: 'POST', path: '/request/:email', - description: 'Request password reset for the given email', + description: 'Request password reset for the given email. This route can only be tested through the frontend.', tags: ['Auth'], // Tag adicionada parameters: [ { @@ -146,7 +158,7 @@ const requestPasswordResetRoute = describeRoute({ const resetPasswordRoute = describeRoute({ method: 'POST', path: '/reset', - description: 'Reset the password using the provided email, token, and new password', + description: 'Reset the password using the provided email, token, and new password. This route can only be tested through the frontend.', tags: ['Auth'], // Tag adicionada parameters: [ { @@ -199,7 +211,7 @@ const resetPasswordRoute = describeRoute({ const confirmEmailRoute = describeRoute({ method: 'GET', path: '/confirm-email', - description: 'Confirma o e-mail de um usuário com base no parâmetro de query', + description: "Confirms a user's email based on the query parameter. This route can only be tested through the frontend.", tags: ['Auth'], parameters: [ { diff --git a/src/documentation/collectionsDescribers.ts b/src/documentation/collectionsDescribers.ts index a64775f317712647f782a710249b810dc9e42407..312bf20655452e092f82465bd406fd2f10d644d0 100644 --- a/src/documentation/collectionsDescribers.ts +++ b/src/documentation/collectionsDescribers.ts @@ -4,27 +4,47 @@ const createCollectionRoute = describeRoute({ path: '/create', description: 'Creates a new collection, which includes generating associated statistics.', tags: ['Collections'], - request: { - body: { - collection_stats_id: { - type: 'number', - description: 'The ID of the collection statistics associated with this collection.', - example: 1 - }, - name: { - type: 'string', - description: 'The name of the collection being created.', - example: 'Art Collection' - }, - description: { - type: 'string', - description: 'A brief description of the collection.', - example: 'A collection of abstract art pieces.' - }, - created_by: { - type: 'string', - description: 'The user ID or name who is creating the collection.', - example: 'user123' + requestBody: { + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + collection_stats_id: { + type: 'number', + description: 'The ID of the collection statistics associated with this collection.', + example: 1 + }, + name: { + type: 'string', + description: 'The name of the collection being created.', + example: 'Art Collection' + }, + description: { + type: 'string', + description: 'A brief description of the collection.', + example: 'A collection of abstract art pieces.' + }, + created_by: { + type: 'string', + description: 'The user ID or name who is creating the collection.', + example: 'user123' + }, + user_id: { + type: 'number', + description: 'The ID of the user creating the collection.', + example: 1 + } + }, + required: ['collection_stats_id', 'name', 'description', 'created_by', 'user_id'], + example: { + collection_stats_id: 1, + name: "collection", + description: "collection description", + created_by: "author", + user_id: 1 + } + } } } }, diff --git a/src/documentation/resource-statsDescriber.ts b/src/documentation/resource-statsDescriber.ts index 648f00f385e62aea872f47ab780c0e75324b516d..7e0be049e12307cd0f2415db8bec8410f744eb52 100644 --- a/src/documentation/resource-statsDescriber.ts +++ b/src/documentation/resource-statsDescriber.ts @@ -66,6 +66,10 @@ import { describeRoute } from 'hono-openapi'; downloads: { type: 'number' }, }, required: ['resourceId', 'views', 'shares', 'downloads'], + example: { + id: 7, + views: 10 + } }, }, }, diff --git a/src/documentation/resourceDescriber.ts b/src/documentation/resourceDescriber.ts index 978af5ef57c26e400274b72f373bd37c8e2fe9fa..0061490d514b75ef98412861c684d63a8de621b3 100644 --- a/src/documentation/resourceDescriber.ts +++ b/src/documentation/resourceDescriber.ts @@ -8,12 +8,57 @@ import { describeRoute } from 'hono-openapi'; requestBody: { content: { 'application/json': { - type: 'object', - properties: { - name: { type: 'string' }, - description: { type: 'string' }, + schema: { + type: 'object', + properties: { + name: { type: 'string' }, + description: { type: 'string' }, + state: { type: 'string' }, + author: { type: 'string' }, + user_id: { type: 'integer' }, + resource_stats_id: { type: 'integer' }, + object_type_id: { type: 'integer' }, + license_id: { type: 'integer' }, + subjects: { + type: 'array', + items: { type: 'integer' }, + }, + language: { + type: 'array', + items: { type: 'integer' }, + }, + educational_stages: { + type: 'array', + items: { type: 'integer' }, + }, + }, + required: [ + 'name', + 'description', + 'state', + 'author', + 'user_id', + 'resource_stats_id', + 'object_type_id', + 'license_id', + 'subjects', + 'language', + 'educational_stages' + ], + }, + example: { + name: 'Sample Resource', + description: 'This is a sample description for the resource.', + state: 'draft', + author: 'nome', + user_id: 1, + resource_stats_id: 1, + object_type_id: 1, + license_id: 1, + subjects: [1, 2], + language: [1], + educational_stages: [1, 2] }, - required: ['name', 'description'], }, }, }, @@ -63,6 +108,14 @@ import { describeRoute } from 'hono-openapi'; description: { type: 'string' }, }, required: ['id'], + example: { + id: 1, + name: "updated", + subjects: [1,2], + language: [1], + educational_stages: [1], + user_id: 1 + } }, }, }, diff --git a/src/documentation/subjectsDescriber.ts b/src/documentation/subjectsDescriber.ts index 76260583139a8c5396ec9a66163b1c8523fce195..f8c7b5437c59a721aa09557245a888742239d34f 100644 --- a/src/documentation/subjectsDescriber.ts +++ b/src/documentation/subjectsDescriber.ts @@ -15,6 +15,9 @@ import { describeRoute } from 'hono-openapi'; description: { type: 'string' }, }, required: ['name'], + example: { + name: "subject" + } }, }, },