Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-strapi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit a455c312
authored
2024-07-10 16:59:52 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
0574f7ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
src/api/vendor/controllers/vendor.js
src/api/vendor/controllers/vendor.js
View file @
a455c31
...
@@ -83,13 +83,26 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
...
@@ -83,13 +83,26 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
console
.
log
(
"should be here"
);
console
.
log
(
"should be here"
);
}
else
{
}
else
{
console
.
log
(
"but is here"
);
console
.
log
(
"but is here"
);
let
final
;
let
str
=
ctx
.
request
.
body
.
data
.
name
// console.log()
let
newStr
=
str
.
replace
(
/ /g
,
''
).
toUpperCase
().
replace
(
/
[^
a-zA-Z
]
/g
,
""
)
if
(
newStr
.
length
>=
4
)
{
final
=
newStr
.
slice
(
0
,
4
);
console
.
log
(
final
+
String
(
Math
.
floor
(
Math
.
random
()
*
90000
)
+
10000
))
}
else
{
final
=
newStr
console
.
log
(
final
+
String
(
Math
.
floor
(
Math
.
random
()
*
90000
)
+
10000
))
}
ctx
.
request
.
body
.
data
.
user
=
currentUser
.
id
;
ctx
.
request
.
body
.
data
.
user
=
currentUser
.
id
;
const
response
=
await
strapi
.
entityService
.
create
(
"api::vendor.vendor"
,
{
const
response
=
await
strapi
.
entityService
.
create
(
"api::vendor.vendor"
,
{
data
:
{
data
:
{
...
ctx
.
request
.
body
.
data
,
...
ctx
.
request
.
body
.
data
,
phone
:
ctx
.
request
.
body
.
data
.
mobileNo
,
phone
:
ctx
.
request
.
body
.
data
.
mobileNo
,
publishedAt
:
date
,
publishedAt
:
date
,
uniqueVendorId
:
str
},
},
});
});
console
.
log
(
"response"
,
response
);
console
.
log
(
"response"
,
response
);
...
@@ -230,7 +243,7 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
...
@@ -230,7 +243,7 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
async
addVendorId
(
ctx
)
{
async
addVendorId
(
ctx
)
{
try
{
try
{
// console.log(ctx.request.body)
// console.log(ctx.request.body)
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment