first commit

This commit is contained in:
2025-12-05 06:21:42 +07:00
commit a3c945a60a
119 changed files with 21757 additions and 0 deletions

View File

@ -0,0 +1,79 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/po/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
// console.log("body :"+req.body);
let nik = req.nik;
// let category = req.body.filecategory;
// let filedoc = category+'_'+nik+'_' + Date.now() + path.extname(file.originalname);
let filedoc = nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
// console.log(filedoc);
req.body.filename = filedoc;
cb(null, filedoc)
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
// if (!file.originalname.match(/\.(png|jpg|pdf)$/)) {
// console.log(file.originalname.match);
if (!file.originalname.match(/\.(docx|pdf|PDF)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx / pdf ) max 5 mb";
cb(new Error('Please upload a word document in ( docx / pdf ) max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,79 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/po/boq")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
// console.log("body :"+req.body);
let nik = req.nik;
// let category = req.body.filecategory;
// let filedoc = category+'_'+nik+'_' + Date.now() + path.extname(file.originalname);
let filedoc = nik+'_boq' + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
// console.log(filedoc);
req.body.filename = filedoc;
cb(null, filedoc)
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
// if (!file.originalname.match(/\.(png|jpg|pdf)$/)) {
// console.log(file.originalname.match);
if (!file.originalname.match(/\.(csv)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( csv ) max 5 mb";
cb(new Error('Please upload a csv file format max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,77 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/procjustification/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
// console.log("body :"+req.body);
let nik = req.nik;
// let category = req.body.filecategory;
// let filedoc = category+'_'+nik+'_' + Date.now() + path.extname(file.originalname);
let filedoc = nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
req.body.filename = filedoc;
cb(null, filedoc)
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
// if (!file.originalname.match(/\.(png|jpg|pdf)$/)) {
if (!file.originalname.match(/\.(docx|pdf)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx / pdf ) max 5 mb";
cb(new Error('Please upload a word document in ( docx / pdf ) max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,74 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/words/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
let nik = req.nik;
let filedoc = 'justifikasi_'+nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
req.body.filename = filedoc;
cb(null, filedoc)
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
// if (!file.originalname.match(/\.(png|jpg|pdf)$/)) {
if (!file.originalname.match(/\.(docx)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx ) max 5 mb";
cb(new Error('Please upload a word document in ( docx ) max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,75 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/bast/pdf/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
let nik = req.nik;
let filedoc = 'bast_'+nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
req.body.filename = filedoc;
cb(null, filedoc);
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
// if (!file.originalname.match(/\.(png|jpg|pdf)$/)) {
// if (!file.originalname.match(/\.(docx|pdf)$/)) {
if (!file.originalname.match(/\.(pdf)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx ) max 5 mb";
cb(new Error('Please upload a word document in ( docx ) max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,74 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/finance/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
let nik = req.nik;
let filedoc = 'fin_'+nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
req.body.filename = filedoc;
cb(null, filedoc);
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
// if (!file.originalname.match(/\.(png|jpg|pdf)$/)) {
if (!file.originalname.match(/\.(docx|pdf)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx / pdf ) max 5 mb";
cb(new Error('Please upload a word document in ( docx / pdf ) max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,74 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/bast/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
let nik = req.nik;
let filedoc = 'basthandover_'+nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
req.body.filename = filedoc;
cb(null, filedoc);
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
if (!file.originalname.match(/\.(docx|pdf|PDF)$/)) {
// if (!file.originalname.match(/\.(docx)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx ) / pdf file max 5 mb";
cb(new Error('Please upload a word document in ( docx ) / pdf file max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,74 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/bast/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
let nik = req.nik;
let filedoc = 'basthandoversign_'+nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
req.body.filename = filedoc;
cb(null, filedoc);
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
if (!file.originalname.match(/\.(docx|pdf|PDF)$/)) {
// if (!file.originalname.match(/\.(docx)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx ) / pdf file max 5 mb";
cb(new Error('Please upload a word document in ( docx ) / pdf file max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}

View File

@ -0,0 +1,76 @@
const multer = require('multer');
const path = require('path');
var imageStorage = multer.diskStorage({
// Destination to store image
// destination: 'assets/images/'+pathDir,
destination: (req, file, cb) => {
console.log('d');
// console.log(req.get("path"));
// let pathdir = req.get("path");
cb(null, "assets/justification/")
// cb(null, "assets/words/" + pathdir + "/")
},
filename : (req, file, cb) => {
// let filename=file.originalname.split(".")[0];
console.log('filed');
let nik = req.nik;
let filedoc = 'justifikasi_'+nik+'_' + Date.now() + path.extname(file.originalname);
// req.body.filedoc = filedoc;
// cb(null, filedoc);
req.body.filename = filedoc;
cb(null, filedoc)
// file.fieldname is name of the field (image)
// path.extname get the uploaded file extension
}
});
var imageUpload = multer({
storage: imageStorage,
limits: {
fileSize: '5mb' // 1000000 Bytes = 5 MB
},
fileFilter(req, file, cb) {
// if (!file.originalname.match(/\.(png|jpg|pdf)$/)) {
if (!file.originalname.match(/\.(docx)$/)) {
// upload only png and jpg format
req.fileValidationError = "Please upload a word document in ( docx ) max 5 mb";
cb(new Error('Please upload a word document in ( docx ) max 5 mb'), false);
}
else{
cb(null, true);
}
}
}).single("file-doc");
module.exports = (req, res, next) => {
try {
imageUpload(req,res, function(err){
try {
// if (err || err instanceof multer.MulterError){
if (err){
res.status(500).send({
"meta":{
"auth": false,
"code" : 500,
"message" : req.fileValidationError || err.toString(),
},
"data" :[]
});
} else {
next();
// console.log('The filename is ' + res.req.file.filename);
}
} catch (error) {
console.log("error "+error);
}
});
} catch (error) {
console.log("error " + error);
error.message = error.message;
error.statusCode = 500;
throw error;
}
}