Código do front está no github: https://github.com/filipecajado/Photos-pic e a api é o mesma disponibilizada no curso - API: https://cursos.alura.com.br/course/angular-fundamentos/task/38530
Ao realizar um upload é retornado o seguinte erro no console:
HttpErrorResponse
error
:
{message: 'Internal server error'}
headers
:
HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
message
:
"Http failure response for http://localhost:3000/photos/upload: 500 Internal Server Error"
name
:
"HttpErrorResponse"
ok
:
false
status
:
500
statusText
:
"Internal Server Error"
url
:
"http://localhost:3000/photos/upload"
No terminal do VSCODE me retorna esse erro:
upload complete
Photo data [Object: null prototype] { description: 'klkl', allowComents: 'true' }
File info {
fieldname: 'imageFile',
originalname: 'download.jpeg',
encoding: '7bit',
mimetype: 'image/jpeg',
destination: 'uploads/imgs',
filename: 'eea238e2-6464-426b-8909-fa483daf134a.jpeg',
path: 'uploads/imgs/eea238e2-6464-426b-8909-fa483daf134a.jpeg',
size: 154522
}
Error: SQLITE_CONSTRAINT: NOT NULL constraint failed: photo.photo_allow_comments
--> in Statement#run([
2023-06-06T12:32:08.299Z,
'eea238e2-6464-426b-8909-fa483daf134a.jpeg',
'klkl',
undefined,
1
], [Function (anonymous)])
at Database.<anonymous> (/home/filipe/Documentos/study-front/server/api/node_modules/sqlite3/lib/sqlite3.js:76:19)
at Database.<anonymous> (/home/filipe/Documentos/study-front/server/api/node_modules/sqlite3/lib/sqlite3.js:20:19)
at /home/filipe/Documentos/study-front/server/api/app/infra/photo-dao.js:68:22
at new Promise (<anonymous>)
at PhotoDao.add (/home/filipe/Documentos/study-front/server/api/app/infra/photo-dao.js:67:16)
at api.addUpload (/home/filipe/Documentos/study-front/server/api/app/api/photo.js:54:36) {
errno: 19,
code: 'SQLITE_CONSTRAINT',
__augmented: true
}
undefined