fix: docs and required field

This commit is contained in:
ericprd 2025-02-27 10:27:57 +08:00
parent 0317ba04d9
commit 7b367f655e
5 changed files with 21 additions and 4 deletions

View File

@ -6,6 +6,7 @@ DB_PORT=
APP_PORT= APP_PORT=
GRACEFULL_TIMEOUT= GRACEFULL_TIMEOUT=
SALT_SECURITY=
REDIS_HOST= REDIS_HOST=
REDIS_USERNAME= REDIS_USERNAME=

View File

@ -97,9 +97,21 @@ DB_USER=your_db_user
DB_PASSWORD=your_db_password DB_PASSWORD=your_db_password
DB_NAME=your_db_name DB_NAME=your_db_name
DB_PORT=3306 # or 5432, depending on your DB type DB_PORT=3306 # or 5432, depending on your DB type
APP_PORT=3000 # example
GRACEFULL_TIMEOUT=10 #example
SALT_SECURITY=your_secret_security
Make sure to replace the values with your actual database details. Make sure to replace the values with your actual database details.
``` ```
## Migrate the Database Using `make migrate`
Before running your application, let's setup your database first.
```bash
make migrate
```
## Build the Binary Using `make build` ## Build the Binary Using `make build`
Run the following command to build your project. The binary will be placed in the `bin` folder. Run the following command to build your project. The binary will be placed in the `bin` folder.

View File

@ -28,6 +28,7 @@ func main() {
var temp subscribeplandomain.SubscribePlan var temp subscribeplandomain.SubscribePlan
if err := db.Where("code = ?", "basic").First(&temp).Error; err != nil { if err := db.Where("code = ?", "basic").First(&temp).Error; err != nil {
log.Print("seeding basic subscribe plan")
db.Create(&subscribeplandomain.SubscribePlan{ db.Create(&subscribeplandomain.SubscribePlan{
ID: uuid.NewString(), ID: uuid.NewString(),
Code: "basic", Code: "basic",

View File

@ -18,10 +18,12 @@ type User struct {
type RegisterStaffReq struct { type RegisterStaffReq struct {
Email string `json:"email" validate:"required"` Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"` Password string `json:"password" validate:"required"`
Username string `json:"username" validate:"required"`
} }
type Staff struct { type Staff struct {
ID string `json:"id"` ID string `json:"id"`
Email string `json:"email" validate:"required"` Email string `json:"email"`
Password string `json:"password" validate:"required"` Password string `json:"password"`
Username string `json:"username"`
} }

View File

@ -71,9 +71,12 @@ paths:
format: email format: email
password: password:
type: string type: string
username:
type: string
required: required:
- email - email
- password - password
- username
responses: responses:
"201": "201":
description: Staff member created description: Staff member created
@ -191,8 +194,6 @@ paths:
required: required:
- email - email
- password - password
- subscribe_plan_id
- phone
responses: responses:
"201": "201":
description: User created description: User created