Skip to content

Commit

Permalink
feat: udpated packages and minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLzq committed Aug 12, 2024
1 parent c9dea99 commit 5238518
Show file tree
Hide file tree
Showing 56 changed files with 1,377 additions and 1,395 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"nodemon",
"Securitec",
"sequelizerc",
"sqlserver",
"unlicensed",
"wearerequired"
]
Expand Down
4 changes: 2 additions & 2 deletions example/express-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"@typescript-eslint/parser": "^8.0.1",
"axios": "^1.7.3",
"dotenv": "^16.4.5",
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint": "^8",
"eslint-config-prettier": "^8",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.8.0",
Expand Down
297 changes: 151 additions & 146 deletions example/express-graphql/pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/express-graphql/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ datasource db {

model User {
id Int @id @default(autoincrement())
lastName String
name String
Expand Down
3 changes: 0 additions & 3 deletions example/express-graphql/src/@types/custom/params.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions example/express-graphql/src/@types/graphQL/context.d.ts

This file was deleted.

14 changes: 7 additions & 7 deletions example/express-graphql/src/database/postgres/queries/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { dbConnection } from '../connection'
import { Id, User as UserSchema, UserDTO } from 'schemas'
import { Logger } from 'utils'

const LOGGER = new Logger(debug('App:Database:Queries:User'))
const logger = new Logger(debug('App:Database:Queries:User'))

const userDBOtoDTO = (userDBO: User): UserDTO =>
const userDBOtoDTO = (userDBO: User) =>
({
...userDBO,
createdAt: userDBO.createdAt.toISOString(),
updatedAt: userDBO.updatedAt.toISOString()
}) as UserDTO
}) satisfies UserDTO

const store = async (userData: UserSchema) => {
try {
Expand All @@ -23,7 +23,7 @@ const store = async (userData: UserSchema) => {

return userDBOtoDTO(user)
} catch (error) {
LOGGER.log({
logger.log({
origin: 'queries/user.ts',
method: store.name,
value: 'error',
Expand All @@ -43,7 +43,7 @@ const removeById = async (id: Id) => {

return true
} catch (error) {
LOGGER.log({
logger.log({
origin: 'queries/user.ts',
method: removeById.name,
value: 'error',
Expand All @@ -65,7 +65,7 @@ const getById = async (id: Id) => {

return userDBOtoDTO(user)
} catch (error) {
LOGGER.log({
logger.log({
origin: 'queries/user.ts',
method: getById.name,
value: 'error',
Expand All @@ -88,7 +88,7 @@ const update = async (id: Id, user: UserSchema) => {

return userDBOtoDTO(userUpdated)
} catch (error) {
LOGGER.log({
logger.log({
origin: 'queries/user.ts',
method: update.name,
value: 'error',
Expand Down
10 changes: 3 additions & 7 deletions example/express-graphql/src/services/BaseHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,11 @@ class BaseHttpService implements Log {
value: 'error',
content: error
})
const errorMessage = message ?? (error as { message: string }).message

if (code)
throw new httpErrors[code](
message ?? (error as { message: string }).message
)
if (code) throw new httpErrors[code](errorMessage)

throw new httpErrors.InternalServerError(
message ?? (error as { message: string }).message
)
throw new httpErrors.InternalServerError(errorMessage)
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/express-graphql/src/utils/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"description": "Operations related to the user"
}
]
}
}
4 changes: 2 additions & 2 deletions example/express-mongo-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"@typescript-eslint/parser": "^8.0.1",
"axios": "^1.7.3",
"dotenv": "^16.4.5",
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint": "^8",
"eslint-config-prettier": "^8",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.8.0",
Expand Down
Loading

0 comments on commit 5238518

Please sign in to comment.