Update template go
This commit is contained in:
31
internal/models/auth.go
Normal file
31
internal/models/auth.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package models
|
||||
|
||||
// LoginRequest represents the login request payload
|
||||
type LoginRequest struct {
|
||||
Username string `json:"username" binding:"required"`
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
|
||||
// TokenResponse represents the token response
|
||||
type TokenResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
ExpiresIn int64 `json:"expires_in"`
|
||||
}
|
||||
|
||||
// JWTClaims represents the JWT claims
|
||||
type JWTClaims struct {
|
||||
UserID string `json:"user_id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
|
||||
// User represents a user for authentication
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Password string `json:"-"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
50
internal/models/product.go
Normal file
50
internal/models/product.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package models
|
||||
|
||||
// ProductGetResponse represents the response for GET products
|
||||
type ProductGetResponse struct {
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// ProductGetByIDResponse represents the response for GET product by ID
|
||||
type ProductGetByIDResponse struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// ProductCreateRequest represents the request for creating product
|
||||
type ProductCreateRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
// Add more fields as needed
|
||||
}
|
||||
|
||||
// ProductCreateResponse represents the response for creating product
|
||||
type ProductCreateResponse struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// ProductUpdateRequest represents the request for updating product
|
||||
type ProductUpdateRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
// Add more fields as needed
|
||||
}
|
||||
|
||||
// ProductUpdateResponse represents the response for updating product
|
||||
type ProductUpdateResponse struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// ProductDeleteResponse represents the response for deleting product
|
||||
type ProductDeleteResponse struct {
|
||||
ID string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// ErrorResponse represents an error response
|
||||
// type ErrorResponse struct {
|
||||
// Error string `json:"error"`
|
||||
// }
|
||||
Reference in New Issue
Block a user