Base Project

This commit is contained in:
Tran Anh Tuan
2026-05-08 14:32:24 +07:00
parent 5a9249c9ea
commit 6a4a96e0ca
74 changed files with 6749 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package models
type Config struct {
Server ServerConfig
Database DatabaseConfig
Cache CacheConfig
Admin AdminConfig
JWT JWTConfig
}
type AdminConfig struct {
Username string
Email string
Password string
FullName string
}
type JWTConfig struct {
SecretKey string
ExpirationHours int
}
type DatabaseConfig struct {
Host string
Port string
Username string
Password string
Name string
}
type ServerConfig struct {
Host string
Port string
PortFrontend string
KeyPassword string
}
type CacheConfig struct {
Username string
Password string
Host string
Port string
}

View File

@@ -0,0 +1 @@
package models

View File

@@ -0,0 +1,13 @@
package requests
type BodyRegisterRequest struct {
Username string `json:"username" binding:"required"`
Email string `json:"email" binding:"required,email"`
FullName string `json:"fullName"`
Password string `json:"password" binding:"required,min=8"`
}
type BodyLoginRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
}

View File

@@ -0,0 +1,6 @@
package requests
type CreateRoleRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
}

View File

@@ -0,0 +1,13 @@
package requests
type CreateWarehouseRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
Address string `json:"address" binding:"required"`
}
type UpdateWarehouseRequest struct {
Name string `json:"name"`
Description string `json:"description"`
Address string `json:"address"`
}

View File

@@ -0,0 +1,8 @@
package responses
type BodyRegisterResponse struct {
ID string `json:"id"`
}
type BodyLoginResponse struct {
Token string `json:"token"`
}

View File

@@ -0,0 +1,5 @@
package responses
type BodyRoleResponse struct {
ID string `json:"id"`
}

View File

@@ -0,0 +1,12 @@
package responses
type CreateWarehouseResponse struct {
ID int64 `json:"id"`
}
type UpdateWarehouseResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Address string `json:"address"`
}

View File

@@ -0,0 +1,11 @@
package models
import "time"
type Role struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy string `json:"createdBy"`
}

View File

@@ -0,0 +1,17 @@
package models
import (
"time"
)
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
FullName string `json:"fullName"`
PasswordHash string `json:"-"`
IsActive bool `json:"isActive"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedBy string `json:"createdBy"`
}

View File

@@ -0,0 +1,12 @@
package models
import "time"
type Warehouse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Address string `json:"address"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}