- Create CreatePlanModal component with Headless UI Dialog - Implement dark mode support throughout plans UI - Update plans/page.tsx with professional card layout - Update plans/[id]/page.tsx with consistent styling - Add proper spacing, typography, and color consistency - Implement smooth animations and transitions - Add success/error message feedback - Improve form UX with better input styling
79 lines
3.5 KiB
Go
79 lines
3.5 KiB
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/lib/pq"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
// Plan represents a subscription plan in the system
|
|
type Plan struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
Name string `json:"name" db:"name"`
|
|
Slug string `json:"slug" db:"slug"`
|
|
Description string `json:"description" db:"description"`
|
|
MinUsers int `json:"min_users" db:"min_users"`
|
|
MaxUsers int `json:"max_users" db:"max_users"` // -1 means unlimited
|
|
MonthlyPrice *decimal.Decimal `json:"monthly_price" db:"monthly_price"`
|
|
AnnualPrice *decimal.Decimal `json:"annual_price" db:"annual_price"`
|
|
Features pq.StringArray `json:"features" db:"features"`
|
|
Differentiators pq.StringArray `json:"differentiators" db:"differentiators"`
|
|
StorageGB int `json:"storage_gb" db:"storage_gb"`
|
|
IsActive bool `json:"is_active" db:"is_active"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
}
|
|
|
|
// CreatePlanRequest represents the request to create a new plan
|
|
type CreatePlanRequest struct {
|
|
Name string `json:"name" validate:"required"`
|
|
Slug string `json:"slug" validate:"required"`
|
|
Description string `json:"description"`
|
|
MinUsers int `json:"min_users" validate:"required,min=1"`
|
|
MaxUsers int `json:"max_users" validate:"required"` // -1 for unlimited
|
|
MonthlyPrice *float64 `json:"monthly_price"`
|
|
AnnualPrice *float64 `json:"annual_price"`
|
|
Features []string `json:"features"`
|
|
Differentiators []string `json:"differentiators"`
|
|
StorageGB int `json:"storage_gb" validate:"required,min=1"`
|
|
IsActive bool `json:"is_active"`
|
|
}
|
|
|
|
// UpdatePlanRequest represents the request to update a plan
|
|
type UpdatePlanRequest struct {
|
|
Name *string `json:"name"`
|
|
Slug *string `json:"slug"`
|
|
Description *string `json:"description"`
|
|
MinUsers *int `json:"min_users"`
|
|
MaxUsers *int `json:"max_users"`
|
|
MonthlyPrice *float64 `json:"monthly_price"`
|
|
AnnualPrice *float64 `json:"annual_price"`
|
|
Features []string `json:"features"`
|
|
Differentiators []string `json:"differentiators"`
|
|
StorageGB *int `json:"storage_gb"`
|
|
IsActive *bool `json:"is_active"`
|
|
}
|
|
|
|
// Subscription represents an agency's subscription to a plan
|
|
type Subscription struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
AgencyID uuid.UUID `json:"agency_id" db:"agency_id"`
|
|
PlanID uuid.UUID `json:"plan_id" db:"plan_id"`
|
|
BillingType string `json:"billing_type" db:"billing_type"` // monthly or annual
|
|
CurrentUsers int `json:"current_users" db:"current_users"`
|
|
Status string `json:"status" db:"status"` // active, suspended, cancelled
|
|
StartDate time.Time `json:"start_date" db:"start_date"`
|
|
RenewalDate time.Time `json:"renewal_date" db:"renewal_date"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
}
|
|
|
|
// CreateSubscriptionRequest represents the request to create a subscription
|
|
type CreateSubscriptionRequest struct {
|
|
AgencyID uuid.UUID `json:"agency_id" validate:"required"`
|
|
PlanID uuid.UUID `json:"plan_id" validate:"required"`
|
|
BillingType string `json:"billing_type" validate:"required,oneof=monthly annual"`
|
|
}
|