init
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"apskel-pos-be/internal/constants"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Organization struct {
|
||||
ID uuid.UUID
|
||||
Name string
|
||||
Email *string
|
||||
PhoneNumber *string
|
||||
PlanType constants.PlanType
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// CreateOrganizationRequest contains both organization and admin user attributes
|
||||
type CreateOrganizationRequest struct {
|
||||
// Organization attributes
|
||||
OrganizationName string `validate:"required,min=1,max=255"`
|
||||
OrganizationEmail *string `validate:"omitempty,email"`
|
||||
OrganizationPhoneNumber *string `validate:"omitempty"`
|
||||
PlanType constants.PlanType `validate:"required"`
|
||||
|
||||
// Admin user attributes
|
||||
AdminName string `validate:"required,min=1,max=255"`
|
||||
AdminEmail string `validate:"required,email"`
|
||||
AdminPassword string `validate:"required,min=6"`
|
||||
|
||||
// Default outlet attributes
|
||||
OutletName string `validate:"required,min=1,max=255"`
|
||||
OutletAddress *string
|
||||
OutletTimezone *string
|
||||
OutletCurrency string `validate:"required,len=3"`
|
||||
}
|
||||
|
||||
type UpdateOrganizationRequest struct {
|
||||
Name *string `validate:"omitempty,min=1,max=255"`
|
||||
Email *string `validate:"omitempty,email"`
|
||||
PhoneNumber *string `validate:"omitempty"`
|
||||
PlanType *constants.PlanType
|
||||
}
|
||||
|
||||
type OrganizationResponse struct {
|
||||
ID uuid.UUID
|
||||
Name string
|
||||
Email *string
|
||||
PhoneNumber *string
|
||||
PlanType constants.PlanType
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// CreateOrganizationResponse contains the created organization, admin user, and default outlet
|
||||
type CreateOrganizationResponse struct {
|
||||
Organization *OrganizationResponse `json:"organization"`
|
||||
AdminUser *UserResponse `json:"admin_user"`
|
||||
DefaultOutlet *OutletResponse `json:"default_outlet"`
|
||||
}
|
||||
|
||||
// Outlet response for the creation response
|
||||
type OutletResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
Name string `json:"name"`
|
||||
Address *string `json:"address"`
|
||||
Timezone *string `json:"timezone"`
|
||||
Currency string `json:"currency"`
|
||||
TaxRate float64 `json:"tax_rate"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user