Skip to content

Commit acefe85

Browse files
committed
multer, data contract exist, disable static public root
1 parent fdebfed commit acefe85

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ By employing clean architecture, you can design applications with very low coupl
1717
- alter table freight_cost : file_pkhoa(text)
1818
- create table user_purchasing : user_id(int), deviced_id(string), kode_akses(string), active(int), entry_date(date)
1919
- create table set_ups : nama(string), nilai(double 18,2)
20-
- setup config nginx on /nginx/sites-enabled/jpj-api-fastify.config:
20+
- setup config nginx on /nginx/sites-enabled/jpj-api-fastify.conf :
2121

2222
===========================================================================
2323

src/app.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ const app = async () => {
106106
contentSecurityPolicy: false,
107107
global: true,
108108
})
109-
server.register(fastifyStatic, {
110-
root: path.join(process.cwd(), 'public'),
111-
prefix: '/public',
112-
})
109+
// server.register(fastifyStatic, {
110+
// root: path.join(process.cwd(), 'public'),
111+
// prefix: '/public',
112+
// })
113113
server.register(multerFastify.contentParser)
114114

115115
const pool = await mysqlConn()

src/data/middlewares/multer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const upload = multerFastify({
103103
fileSize: 600000000,
104104
},
105105
fileFilter(req, file, cb) {
106-
if (!file.originalname.match(/\.(png|jpg|jepg|docx|pdf)$/)) {
106+
if (!file.originalname.match(/\.(png|jpg|jpeg|docx|pdf)$/)) {
107107
return cb(
108108
new AppError(500, false,
109109
'Please Upload File :pdf or .jpg or .jpeg or .png or .docx',

src/data/middlewares/purchasing/check-exist-kontrak-pks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function CheckExistKontrakPks(purchasingDataSource: IPurchasingDataSource
1515
const checkExistKontrakPks = await purchasingDataSource.selectWhereDynamic(conf)
1616

1717
if (checkExistKontrakPks && !reEntry) {
18-
done(new AppError(400, true, 'Data sudah ada, Apa anda ingin melanjutkan input data ini ?', '401'))
18+
done(new AppError(400, true, 'Data contract sudah pernah diupload, apakah anda ingin melanjutkan upload data ini ?', '401'))
1919
}
2020

2121
} catch (error) {

0 commit comments

Comments
 (0)