Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
widgetTemplate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shweta Gupta
widgetTemplate
Commits
5c18b45f
Commit
5c18b45f
authored
10 months ago
by
Nayana Mogaveera
Browse files
Options
Downloads
Plain Diff
Merge branch 'nayana' into 'development'
commit15-33-sep-05 See merge request
!6
parents
5fb8f07b
15216f4c
No related branches found
No related tags found
1 merge request
!6
commit15-33-sep-05
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
api/template/business.js
+3
-3
3 additions, 3 deletions
api/template/business.js
api/template/controller.js
+3
-3
3 additions, 3 deletions
api/template/controller.js
api/template/routes.js
+2
-2
2 additions, 2 deletions
api/template/routes.js
api/template/service.js
+5
-3
5 additions, 3 deletions
api/template/service.js
with
13 additions
and
11 deletions
api/template/business.js
+
3
−
3
View file @
5c18b45f
...
@@ -24,9 +24,9 @@ const createTemplate = async (name, desc, widgets, hashId) => {
...
@@ -24,9 +24,9 @@ const createTemplate = async (name, desc, widgets, hashId) => {
};
};
const
getP
e
rticular
Widget
=
async
(
page
)
=>
{
const
getP
a
rticular
Template
=
async
(
page
)
=>
{
try
{
try
{
const
response
=
await
templateService
.
getP
e
rticular
Widget
(
page
);
const
response
=
await
templateService
.
getP
a
rticular
Template
(
page
);
console
.
log
(
page
,
"
Pagessssssss
"
);
console
.
log
(
page
,
"
Pagessssssss
"
);
return
{
status
:
'
200
'
,
response
}
return
{
status
:
'
200
'
,
response
}
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -38,5 +38,5 @@ const getPerticularWidget = async (page) => {
...
@@ -38,5 +38,5 @@ const getPerticularWidget = async (page) => {
module
.
exports
=
{
module
.
exports
=
{
updateAndMapWidget
,
updateAndMapWidget
,
createTemplate
,
createTemplate
,
getP
e
rticular
Widget
getP
a
rticular
Template
};
};
This diff is collapsed.
Click to expand it.
api/template/controller.js
+
3
−
3
View file @
5c18b45f
...
@@ -26,11 +26,11 @@ const createTemplate = async (req, res, next) => {
...
@@ -26,11 +26,11 @@ const createTemplate = async (req, res, next) => {
}
}
};
};
const
getP
e
rticular
Widget
=
async
(
req
,
res
)
=>
{
const
getP
a
rticular
Template
=
async
(
req
,
res
)
=>
{
try
{
try
{
console
.
log
(
"
GET template details of a particular page
"
);
console
.
log
(
"
GET template details of a particular page
"
);
const
{
page
}
=
req
.
params
;
const
{
page
}
=
req
.
params
;
const
response
=
await
templateBusiness
.
getP
e
rticular
Widget
(
page
);
const
response
=
await
templateBusiness
.
getP
a
rticular
Template
(
page
);
return
res
.
status
(
response
.
status
).
json
({
data
:
response
});
return
res
.
status
(
response
.
status
).
json
({
data
:
response
});
}
catch
(
error
)
{
}
catch
(
error
)
{
throw
error
;
throw
error
;
...
@@ -40,5 +40,5 @@ const getPerticularWidget = async (req, res) => {
...
@@ -40,5 +40,5 @@ const getPerticularWidget = async (req, res) => {
module
.
exports
=
{
module
.
exports
=
{
updateAndMapWidget
,
updateAndMapWidget
,
createTemplate
,
createTemplate
,
getP
e
rticular
Widget
getP
a
rticular
Template
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
api/template/routes.js
+
2
−
2
View file @
5c18b45f
const
templateRouter
=
require
(
'
express
'
).
Router
();
const
templateRouter
=
require
(
'
express
'
).
Router
();
const
{
updateAndMapWidget
,
createTemplate
,
getP
e
rticular
Widget
}
=
require
(
'
./controller
'
);
const
{
updateAndMapWidget
,
createTemplate
,
getP
a
rticular
Template
}
=
require
(
'
./controller
'
);
templateRouter
.
put
(
'
/:page/widgets/:widgetId
'
,
updateAndMapWidget
);
templateRouter
.
put
(
'
/:page/widgets/:widgetId
'
,
updateAndMapWidget
);
templateRouter
.
post
(
'
/createTemplate
'
,
createTemplate
);
templateRouter
.
post
(
'
/createTemplate
'
,
createTemplate
);
templateRouter
.
get
(
'
/template/:page
'
,
getP
e
rticular
Widget
);
templateRouter
.
get
(
'
/template/:page
'
,
getP
a
rticular
Template
);
module
.
exports
=
templateRouter
;
module
.
exports
=
templateRouter
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
api/template/service.js
+
5
−
3
View file @
5c18b45f
...
@@ -56,11 +56,13 @@ const createTemplate = async (name, desc, widgets, hashId) => {
...
@@ -56,11 +56,13 @@ const createTemplate = async (name, desc, widgets, hashId) => {
};
};
const
getP
e
rticular
Widget
=
async
(
page
,
res
)
=>
{
const
getP
a
rticular
Template
=
async
(
page
,
res
)
=>
{
try
{
try
{
const
template
=
await
Template
.
findOne
({
name
:
page
}).
populate
(
'
widgets.widgetId
'
);
const
template
=
await
Template
.
findOne
({
name
:
page
}).
populate
(
'
widgets.widgetId
'
);
if
(
!
template
)
{
if
(
!
template
)
{
return
res
.
status
(
404
).
json
({
error
:
'
Template not found
'
});
// return res.status(404).json({ error: 'Template not found' });
console
.
error
(
'
Template not found
'
);
res
.
status
(
404
).
send
();
}
}
return
template
;
return
template
;
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -73,5 +75,5 @@ const getPerticularWidget = async (page,res) => {
...
@@ -73,5 +75,5 @@ const getPerticularWidget = async (page,res) => {
module
.
exports
=
{
module
.
exports
=
{
updateAndMapWidget
,
updateAndMapWidget
,
createTemplate
,
createTemplate
,
getP
e
rticular
Widget
getP
a
rticular
Template
};
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment