59 lines
2.1 KiB
Go
59 lines
2.1 KiB
Go
|
|
package contract
|
||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/google/uuid"
|
||
|
|
)
|
||
|
|
|
||
|
|
type CreateCustomerRequest struct {
|
||
|
|
Name string `json:"name" validate:"required"`
|
||
|
|
Email *string `json:"email,omitempty" validate:"omitempty,email"`
|
||
|
|
Phone *string `json:"phone,omitempty"`
|
||
|
|
Address *string `json:"address,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type UpdateCustomerRequest struct {
|
||
|
|
Name *string `json:"name,omitempty" validate:"omitempty,required"`
|
||
|
|
Email *string `json:"email,omitempty" validate:"omitempty,email"`
|
||
|
|
Phone *string `json:"phone,omitempty"`
|
||
|
|
Address *string `json:"address,omitempty"`
|
||
|
|
IsActive *bool `json:"is_active,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type CustomerResponse struct {
|
||
|
|
ID uuid.UUID `json:"id"`
|
||
|
|
OrganizationID uuid.UUID `json:"organization_id"`
|
||
|
|
Name string `json:"name"`
|
||
|
|
Email *string `json:"email,omitempty"`
|
||
|
|
Phone *string `json:"phone,omitempty"`
|
||
|
|
Address *string `json:"address,omitempty"`
|
||
|
|
IsDefault bool `json:"is_default"`
|
||
|
|
IsActive bool `json:"is_active"`
|
||
|
|
Metadata map[string]interface{} `json:"metadata"`
|
||
|
|
CreatedAt time.Time `json:"created_at"`
|
||
|
|
UpdatedAt time.Time `json:"updated_at"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type ListCustomersRequest struct {
|
||
|
|
Page int `json:"page" validate:"min=1"`
|
||
|
|
Limit int `json:"limit" validate:"min=1,max=100"`
|
||
|
|
Search string `json:"search"`
|
||
|
|
IsActive *bool `json:"is_active"`
|
||
|
|
IsDefault *bool `json:"is_default"`
|
||
|
|
SortBy string `json:"sort_by" validate:"omitempty,oneof=name email created_at updated_at"`
|
||
|
|
SortOrder string `json:"sort_order" validate:"omitempty,oneof=asc desc"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type SetDefaultCustomerRequest struct {
|
||
|
|
CustomerID uuid.UUID `json:"customer_id" validate:"required"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type PaginatedCustomerResponse struct {
|
||
|
|
Data []CustomerResponse `json:"data"`
|
||
|
|
TotalCount int `json:"total_count"`
|
||
|
|
Page int `json:"page"`
|
||
|
|
Limit int `json:"limit"`
|
||
|
|
TotalPages int `json:"total_pages"`
|
||
|
|
}
|