Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
RepaiCenter-api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaiwat
RepaiCenter-api
Commits
0ed9ae9d
Commit
0ed9ae9d
authored
May 15, 2022
by
chaiwat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
3a60b1d8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
RepairDetailController.js
src/controller/RepairDetailController.js
+9
-5
database.js
src/services/database.js
+2
-2
lineApi.js
src/services/lineApi.js
+1
-1
No files found.
src/controller/RepairDetailController.js
View file @
0ed9ae9d
...
...
@@ -14,7 +14,7 @@ const {
}
=
require
(
"../services/funcCallback"
);
const
responseCode
=
require
(
"../configs/responseCode"
);
const
{
pushMessage
}
=
require
(
'../services/lineApi'
);
const
{
pushMessage
}
=
require
(
"../services/lineApi"
);
const
router
=
express
.
Router
();
...
...
@@ -65,7 +65,7 @@ router.get("/all", (request, response, next) => {
// Get By Member
router
.
get
(
"/getbymember"
,
(
request
,
response
,
next
)
=>
{
let
data
=
request
.
query
;
console
.
log
(
data
)
console
.
log
(
data
)
;
try
{
callGetByMember
(
data
,
function
(
err
,
datas
,
status
)
{
if
(
status
==
responseCode
.
SUCCESS
)
{
...
...
@@ -216,7 +216,7 @@ router.get("/getspare-detailid", (request, response, next) => {
router
.
delete
(
"/delete-spare"
,
async
(
request
,
response
,
next
)
=>
{
try
{
let
data
=
request
.
body
;
console
.
log
(
'555'
,
data
)
console
.
log
(
"555"
,
data
);
callDeleteSpare
(
data
,
function
(
err
,
datas
,
status
)
{
if
(
status
==
responseCode
.
SUCCESS
)
{
...
...
@@ -244,7 +244,8 @@ router.put("/update-detail", (request, response, next) => {
try
{
callUpdateDetail
(
data
,
function
(
err
,
datas
,
status
)
{
// console.log(status)
pushMessage
(
datas
)
// console.log('datas', datas.status)
if
(
status
==
responseCode
.
SUCCESS
)
{
response
.
json
({
code
:
200
,
...
...
@@ -252,6 +253,10 @@ router.put("/update-detail", (request, response, next) => {
total
:
datas
.
length
,
data
:
datas
,
});
if
(
datas
[
0
].
status
===
"สำเร็จ"
)
{
pushMessage
(
datas
);
}
}
else
{
response
.
json
({
code
:
400
,
...
...
@@ -264,5 +269,4 @@ router.put("/update-detail", (request, response, next) => {
}
});
module
.
exports
=
router
;
src/services/database.js
View file @
0ed9ae9d
...
...
@@ -638,7 +638,7 @@ function getByMember(data, callback) {
let
sql
=
`SELECT * FROM repairdetails AS a
INNER JOIN member AS b ON a.member_tel = b.member_tel
INNER JOIN garage AS c ON a.garageID = c.garageID
WHERE a.member_tel =
${
memberTel
}
ORDER BY a.repair_date
A
SC `
;
WHERE a.member_tel =
${
memberTel
}
ORDER BY a.repair_date
DE
SC `
;
db
.
query
(
sql
,
function
(
err
,
rows
)
{
if
(
err
)
return
callback
(
err
);
...
...
@@ -658,7 +658,7 @@ function getByGarage(data, callback) {
let
sql
=
`SELECT * FROM repairdetails AS a
INNER JOIN member AS b ON a.member_tel = b.member_tel
INNER JOIN garage AS c ON a.garageID = c.garageID
WHERE a.garageID = "
${
garageID
}
" ORDER BY repair_date
A
SC`
;
WHERE a.garageID = "
${
garageID
}
" ORDER BY repair_date
DE
SC`
;
db
.
query
(
sql
,
function
(
err
,
rows
)
{
if
(
err
)
return
callback
(
err
);
...
...
src/services/lineApi.js
View file @
0ed9ae9d
...
...
@@ -2,7 +2,7 @@ const request = require("request");
const
responseCode
=
require
(
"../configs/responseCode"
);
async
function
pushMessage
(
data
)
{
console
.
log
(
"data in pushMessage "
,
data
[
0
]);
//
console.log("data in pushMessage ", data[0]);
let
headers
=
{
"Content-Type"
:
"application/json"
,
Authorization
:
...
...
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