fix(erp): enable erp pages and menu items
This commit is contained in:
32
backend/internal/domain/document.go
Normal file
32
backend/internal/domain/document.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Document struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
ParentID *uuid.UUID `json:"parent_id" db:"parent_id"`
|
||||
Title string `json:"title" db:"title"`
|
||||
Content string `json:"content" db:"content"` // JSON for blocks
|
||||
Status string `json:"status" db:"status"` // draft, published
|
||||
CreatedBy uuid.UUID `json:"created_by" db:"created_by"`
|
||||
LastUpdatedBy uuid.UUID `json:"last_updated_by" db:"last_updated_by"`
|
||||
Version int `json:"version" db:"version"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
}
|
||||
|
||||
type DocumentActivity struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
DocumentID uuid.UUID `json:"document_id" db:"document_id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
UserID uuid.UUID `json:"user_id" db:"user_id"`
|
||||
UserName string `json:"user_name" db:"user_name"` // For join
|
||||
Action string `json:"action" db:"action"`
|
||||
Description string `json:"description" db:"description"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
}
|
||||
115
backend/internal/domain/erp.go
Normal file
115
backend/internal/domain/erp.go
Normal file
@@ -0,0 +1,115 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
// FinancialCategory represents a category for income or expenses
|
||||
type FinancialCategory struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Type string `json:"type" db:"type"` // income, expense
|
||||
Color string `json:"color" db:"color"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// BankAccount represents a financial account in the agency
|
||||
type BankAccount struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
BankName string `json:"bank_name" db:"bank_name"`
|
||||
InitialBalance decimal.Decimal `json:"initial_balance" db:"initial_balance"`
|
||||
CurrentBalance decimal.Decimal `json:"current_balance" db:"current_balance"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// Entity represents a customer or supplier in the ERP
|
||||
type Entity struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Document string `json:"document" db:"document"`
|
||||
Email string `json:"email" db:"email"`
|
||||
Phone string `json:"phone" db:"phone"`
|
||||
Type string `json:"type" db:"type"` // customer, supplier, both
|
||||
Status string `json:"status" db:"status"`
|
||||
Address string `json:"address" db:"address"`
|
||||
City string `json:"city" db:"city"`
|
||||
State string `json:"state" db:"state"`
|
||||
Zip string `json:"zip" db:"zip"`
|
||||
Notes string `json:"notes" db:"notes"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
}
|
||||
|
||||
// FinancialTransaction represents a single financial movement
|
||||
type FinancialTransaction struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
AccountID *uuid.UUID `json:"account_id" db:"account_id"`
|
||||
CategoryID *uuid.UUID `json:"category_id" db:"category_id"`
|
||||
EntityID *uuid.UUID `json:"entity_id" db:"entity_id"`
|
||||
CRMCustomerID *uuid.UUID `json:"crm_customer_id" db:"crm_customer_id"`
|
||||
CompanyID *uuid.UUID `json:"company_id" db:"company_id"`
|
||||
Description string `json:"description" db:"description"`
|
||||
Amount decimal.Decimal `json:"amount" db:"amount"`
|
||||
Type string `json:"type" db:"type"` // income, expense
|
||||
Status string `json:"status" db:"status"` // pending, paid, cancelled
|
||||
DueDate *time.Time `json:"due_date" db:"due_date"`
|
||||
PaymentDate *time.Time `json:"payment_date" db:"payment_date"`
|
||||
PaymentMethod string `json:"payment_method" db:"payment_method"`
|
||||
Attachments []string `json:"attachments" db:"attachments"`
|
||||
CreatedBy uuid.UUID `json:"created_by" db:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
}
|
||||
|
||||
// Product represents a product or service in the catalog
|
||||
type Product struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
SKU string `json:"sku" db:"sku"`
|
||||
Description string `json:"description" db:"description"`
|
||||
Price decimal.Decimal `json:"price" db:"price"`
|
||||
CostPrice decimal.Decimal `json:"cost_price" db:"cost_price"`
|
||||
Type string `json:"type" db:"type"` // product, service
|
||||
StockQuantity int `json:"stock_quantity" db:"stock_quantity"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// Order represents a sales or service order
|
||||
type Order struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
TenantID uuid.UUID `json:"tenant_id" db:"tenant_id"`
|
||||
CustomerID *uuid.UUID `json:"customer_id" db:"customer_id"`
|
||||
EntityID *uuid.UUID `json:"entity_id" db:"entity_id"`
|
||||
Status string `json:"status" db:"status"` // draft, confirmed, completed, cancelled
|
||||
TotalAmount decimal.Decimal `json:"total_amount" db:"total_amount"`
|
||||
Notes string `json:"notes" db:"notes"`
|
||||
CreatedBy uuid.UUID `json:"created_by" db:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
}
|
||||
|
||||
// OrderItem represents an item within an order
|
||||
type OrderItem struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
OrderID uuid.UUID `json:"order_id" db:"order_id"`
|
||||
ProductID uuid.UUID `json:"product_id" db:"product_id"`
|
||||
Quantity int `json:"quantity" db:"quantity"`
|
||||
UnitPrice decimal.Decimal `json:"unit_price" db:"unit_price"`
|
||||
TotalPrice decimal.Decimal `json:"total_price" db:"total_price"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user