changes on user creation
parent
890e6a96c5
commit
45e7d9f99a
32
.env
32
.env
|
|
@ -12,21 +12,21 @@ API_SECRET=nyEX8BZ44KqTXeV2
|
||||||
#DB_PORT=5432
|
#DB_PORT=5432
|
||||||
|
|
||||||
# DB configuration HOMOLOGAÇÃO
|
# DB configuration HOMOLOGAÇÃO
|
||||||
API_PORT=8111
|
#API_PORT=8111
|
||||||
API_RELEASE="Homologação"
|
#API_RELEASE="Homologação"
|
||||||
DB_HOST=191.252.214.157
|
#DB_HOST=191.252.214.157
|
||||||
DB_DRIVER=postgres
|
#DB_DRIVER=postgres
|
||||||
DB_USER=pcasthomolog
|
#DB_USER=pcasthomolog
|
||||||
DB_PASSWORD=@407Smc837
|
#DB_PASSWORD=@407Smc837
|
||||||
DB_NAME=pcasthomolog
|
#DB_NAME=pcasthomolog
|
||||||
DB_PORT=5432
|
#DB_PORT=5432
|
||||||
|
|
||||||
# DB configuration PRODUÇÃO
|
# DB configuration PRODUÇÃO
|
||||||
#API_PORT=8112
|
API_PORT=8112
|
||||||
#API_RELEASE=""
|
API_RELEASE=""
|
||||||
#DB_HOST=177.153.50.98
|
DB_HOST=177.153.50.98
|
||||||
#DB_DRIVER=postgres
|
DB_DRIVER=postgres
|
||||||
#DB_USER=pcast
|
DB_USER=pcast
|
||||||
#DB_PASSWORD=@407Smc837
|
DB_PASSWORD=@407Smc837
|
||||||
#DB_NAME=pcast
|
DB_NAME=pcast
|
||||||
#DB_PORT=5432
|
DB_PORT=5432
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
api
|
api
|
||||||
api.exe
|
api.exe
|
||||||
|
|
||||||
|
.env
|
||||||
|
|
||||||
pcast.db
|
pcast.db
|
||||||
api-homolog.log
|
api-homolog.log
|
||||||
.gitignore
|
.gitignore
|
||||||
|
|
|
||||||
|
|
@ -85,15 +85,7 @@ func AddUser(c *fiber.Ctx) error {
|
||||||
return fiber.ErrBadRequest
|
return fiber.ErrBadRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// If I don't receive an auth field in the request, I need to verify if the sender is logged
|
if data["name"] == "" || data["email"] == "" || data["password"] == "" || data["channel"] == "" || data["usertype"] == "" || data["companyname"] == "" {
|
||||||
if data["auth"] == "" {
|
|
||||||
_, err := utils.ProcessToken(c)
|
|
||||||
if err != nil {
|
|
||||||
return fiber.ErrUnauthorized
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if data["name"] == "" || data["email"] == "" || data["password"] == "" || data["channel"] == "" {
|
|
||||||
return fiber.ErrBadRequest
|
return fiber.ErrBadRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +100,7 @@ func AddUser(c *fiber.Ctx) error {
|
||||||
UserType: data["usertype"],
|
UserType: data["usertype"],
|
||||||
Blocked: "N",
|
Blocked: "N",
|
||||||
Cancelled: "N",
|
Cancelled: "N",
|
||||||
CreatedBy: data["creator"],
|
CreatedBy: data["createdby"],
|
||||||
}
|
}
|
||||||
|
|
||||||
database.DB.Create(&user)
|
database.DB.Create(&user)
|
||||||
|
|
@ -117,9 +109,7 @@ func AddUser(c *fiber.Ctx) error {
|
||||||
return fiber.ErrNotAcceptable
|
return fiber.ErrNotAcceptable
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(fiber.Map{
|
return c.JSON(user)
|
||||||
"user": user,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOwnUser - Returns the current user
|
// GetOwnUser - Returns the current user
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue