Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
eue
Commits
32bf5cbb
Commit
32bf5cbb
authored
May 17, 2021
by
KangMin An
Browse files
Update : Data 저장 경로 문제로 인한 수정.
parent
d9b0e9dc
Changes
1
Show whitespace changes
Inline
Side-by-side
server/src/controllers/dataController.js
View file @
32bf5cbb
...
@@ -2,6 +2,9 @@ import fs from "fs";
...
@@ -2,6 +2,9 @@ import fs from "fs";
import
fetch
from
"
node-fetch
"
;
import
fetch
from
"
node-fetch
"
;
import
{
serverMSG
,
statusCode
}
from
"
../serverinfo
"
;
import
{
serverMSG
,
statusCode
}
from
"
../serverinfo
"
;
import
{
pool
as
db
,
dbMSG
,
pool
}
from
"
../db
"
;
import
{
pool
as
db
,
dbMSG
,
pool
}
from
"
../db
"
;
import
dotenv
from
"
dotenv
"
;
dotenv
.
config
();
const
OUT
=
"
Out
"
;
const
OUT
=
"
Out
"
;
const
IN
=
"
In
"
;
const
IN
=
"
In
"
;
...
@@ -57,14 +60,17 @@ const getDataDIR = async (loc, time, type, id) => {
...
@@ -57,14 +60,17 @@ const getDataDIR = async (loc, time, type, id) => {
`FROM
${
type
===
OUT
?
"
LOCINFO
"
:
"
USER
"
}
`
+
`FROM
${
type
===
OUT
?
"
LOCINFO
"
:
"
USER
"
}
`
+
"
"
+
"
"
+
`WHERE
${
type
===
OUT
?
`CODE=
${
loc
.
EMD
}
`
:
`ID='
${
id
}
'`
}
`
;
`WHERE
${
type
===
OUT
?
`CODE=
${
loc
.
EMD
}
`
:
`ID='
${
id
}
'`
}
`
;
const
[
row
,
fields
]
=
await
db
.
execute
(
select_query
);
const
[
row
,
fields
]
=
await
db
.
execute
(
select_query
);
let
baseDIR
=
row
[
0
][
"
DATALINK
"
];
let
baseDIR
;
if
(
row
.
length
!=
0
)
baseDIR
=
row
[
0
][
"
DATALINK
"
];
else
baseDIR
=
null
;
// DB에 Data 저장 경로가 존재하지 않을 시 UPDATE
// DB에 Data 저장 경로가 존재하지 않을 시 UPDATE
if
(
baseDIR
===
null
)
{
if
(
baseDIR
===
null
)
{
baseDIR
=
baseDIR
=
"
.
/data
"
+
"
/data
"
+
`/
${
loc
.
DO
}
`
+
`/
${
loc
.
DO
}
`
+
`/
${
loc
.
SGG
}
`
+
`/
${
loc
.
SGG
}
`
+
`/
${
loc
.
EMD
}
`
+
`/
${
loc
.
EMD
}
`
+
...
@@ -83,9 +89,7 @@ const getDataDIR = async (loc, time, type, id) => {
...
@@ -83,9 +89,7 @@ const getDataDIR = async (loc, time, type, id) => {
const
timeDIR
=
`/
${
year
}
`
+
`/
${
year
}${
month
}
`
+
`/
${
year
}${
month
}${
date
}
`
;
const
timeDIR
=
`/
${
year
}
`
+
`/
${
year
}${
month
}
`
+
`/
${
year
}${
month
}${
date
}
`
;
// 최종 Data 저장소 경로
// 최종 Data 저장소 경로
const
repoDIR
=
baseDIR
+
timeDIR
;
const
repoDIR
=
process
.
env
.
LOCAL_SERVER_DIR
+
baseDIR
+
timeDIR
;
console
.
log
(
repoDIR
);
return
repoDIR
;
return
repoDIR
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment