Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hw88AlenBolatov
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Болатов Ален
hw88AlenBolatov
Commits
27a22a9c
Commit
27a22a9c
authored
2 years ago
by
Болатов Ален
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added controller update to router
parent
f0a6ca24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
Generic.ts
backend/src/controllers/Generic.ts
+5
-1
Product.ts
backend/src/routes/Product.ts
+1
-0
No files found.
backend/src/controllers/Generic.ts
View file @
27a22a9c
...
@@ -73,7 +73,11 @@ const update = (model: Model<any>) => (req: Request, res: Response) => {
...
@@ -73,7 +73,11 @@ const update = (model: Model<any>) => (req: Request, res: Response) => {
model
model
.
findByIdAndUpdate
(
id
,
data
)
.
findByIdAndUpdate
(
id
,
data
)
.
then
((
result
)
=>
{
.
then
((
result
)
=>
{
return
res
.
status
(
200
).
send
(
result
);
if
(
result
)
{
return
res
.
status
(
200
).
send
(
result
);
}
else
{
return
res
.
json
({
message
:
'Not found'
});
}
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
...
...
This diff is collapsed.
Click to expand it.
backend/src/routes/Product.ts
View file @
27a22a9c
...
@@ -11,6 +11,7 @@ const router: Router = express.Router();
...
@@ -11,6 +11,7 @@ const router: Router = express.Router();
router
.
get
(
'/'
,
controller
.
getAll
(
model
,
[
'category'
,
'location'
]));
router
.
get
(
'/'
,
controller
.
getAll
(
model
,
[
'category'
,
'location'
]));
router
.
get
(
'/:id'
,
controller
.
get
(
model
,
[
'category'
,
'location'
]));
router
.
get
(
'/:id'
,
controller
.
get
(
model
,
[
'category'
,
'location'
]));
router
.
delete
(
'/:id'
,
controller
.
deleteDoc
(
model
));
router
.
delete
(
'/:id'
,
controller
.
deleteDoc
(
model
));
router
.
put
(
'/:id'
,
controller
.
update
(
model
));
router
.
post
(
router
.
post
(
'/'
,
'/'
,
...
...
This diff is collapsed.
Click to expand it.
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