Skip to content

Commit 46d06fd

Browse files
authored
Merge pull request #171 from AthennaIO/develop
feat(command): adjust swagger docs in routes
2 parents 6d7b9c4 + 9dbf2c0 commit 46d06fd

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/database",
3-
"version": "4.59.0",
3+
"version": "4.60.0",
44
"description": "The Athenna database handler for SQL/NoSQL.",
55
"license": "MIT",
66
"author": "João Lenon <lenon@athenna.io>",

src/commands/MakeCrudCommand.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -408,22 +408,20 @@ export class MakeCrudCommand extends BaseCommand {
408408
.filter(p => p.custom)
409409
.forEach(property => {
410410
const type = {
411-
string: `'string'`,
412-
number: 1,
413-
boolean: true,
414-
Date: 'new Date()'
411+
string: 'string',
412+
number: 'number',
413+
boolean: 'boolean',
414+
Date: 'string'
415415
}
416416

417-
body += `${property.name}: ${type[property.type]}, `
417+
body += `.body('${property.name}', { type: '${type[property.type]}' })`
418418
})
419419

420420
const routeContent = `
421421
Route.get('${path}', '${controller}.index')
422-
Route.post('${path}', '${controller}.store').body({
423-
${body.slice(0, body.length - 2)}
424-
})
425-
Route.show('${path}/:id', '${controller}.show')
426-
Route.put('${path}/:id', '${controller}.update')
422+
Route.post('${path}', '${controller}.store')${body}
423+
Route.get('${path}/:id', '${controller}.show')
424+
Route.put('${path}/:id', '${controller}.update')${body}
427425
Route.delete('${path}/:id', '${controller}.delete')
428426
\n`
429427

src/models/factories/ModelGenerator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class ModelGenerator<M extends BaseModel = any> {
8181
return
8282
}
8383

84-
if (column.type === String && ObjectId.isValidObject(object[key])) {
84+
if (ObjectId.isValidObject(object[key])) {
8585
object[key] = object[key].toString()
8686
}
8787

0 commit comments

Comments
 (0)