dealroom/internal/model/models.go

202 lines
4.1 KiB
Go

package model
import (
"time"
)
// Now returns the current Unix timestamp
func Now() int64 {
return time.Now().Unix()
}
// TimeFromUnix converts Unix timestamp to time.Time
func TimeFromUnix(unix int64) time.Time {
return time.Unix(unix, 0)
}
type Organization struct {
ID string
Name string
Slug string
OrgType string // bank, pe_vc, company
CreatedAt time.Time
}
type Profile struct {
ID string
Email string
FullName string
AvatarURL string
OrganizationID string
Role string // owner, admin, member, viewer
PasswordHash string
CreatedAt time.Time
LastLogin *time.Time
BuyerGroup string
ViewAsBuyer bool // Not persisted, set per-request from cookie
}
type Deal struct {
ID string
OrganizationID string
Name string
Description string
TargetCompany string
Stage string // pipeline, loi, initial_review, due_diligence, final_negotiation, closed, dead
DealSize float64
Currency string
IOIDate string
LOIDate string
ExclusivityEnd string
ExpectedCloseDate string
CloseProbability int
Industry string
BuyerCanComment bool
SellerCanComment bool
IsArchived bool
CreatedBy string
CreatedAt time.Time
UpdatedAt time.Time
// Computed
FileCount int
}
type Folder struct {
ID string
DealID string
ParentID string
Name string
Description string
SortOrder int
CreatedBy string
CreatedAt time.Time
}
type File struct {
ID string
DealID string
FolderID string
Name string
FileSize int64
MimeType string
Status string // uploaded, processing, reviewed, flagged, archived
StoragePath string
UploadedBy string
CreatedAt time.Time
}
type DiligenceRequest struct {
ID string
DealID string
ItemNumber string
Section string
Description string
Priority string // high, medium, low
AtlasStatus string // fulfilled, partial, missing, not_applicable
AtlasNote string
Confidence int
BuyerComment string
SellerComment string
BuyerGroup string
LinkedFileIDs string
IsBuyerSpecific bool
VisibleToBuyerGroup string
CreatedBy string
CreatedAt time.Time
UpdatedAt time.Time
}
type Contact struct {
ID string
OrganizationID string
FullName string
Email string
Phone string
Company string
Title string
ContactType string // buyer, internal, advisor
Tags string
Notes string
LastActivityAt *time.Time
CreatedAt time.Time
// Computed
DealNames []string
}
type DealActivity struct {
ID string
OrganizationID string
DealID string
UserID string
ActivityType string
ResourceType string
ResourceName string
ResourceID string
Details string
BuyerGroup string
TimeSpentSeconds int
CreatedAt time.Time
// Computed
UserName string
DealName string
}
type Session struct {
Token string
UserID string
ExpiresAt time.Time
CreatedAt time.Time
}
type FileComment struct {
ID string
FileID string
DealID string
UserID string
Content string
CreatedAt time.Time
UserName string // computed
}
type Invite struct {
Token string
OrgID string
Email string
Role string
InvitedBy string
ExpiresAt time.Time
UsedAt *time.Time
CreatedAt time.Time
}
// StageName returns human-readable stage name
func StageName(stage string) string {
switch stage {
case "prospect":
return "Prospect"
case "internal":
return "Internal"
case "initial_marketing":
return "Initial Marketing"
case "ioi":
return "IOI"
case "loi":
return "LOI"
case "closed":
return "Closed"
// Legacy stages (backward compat)
case "pipeline":
return "Prospect"
case "initial_review":
return "Initial Marketing"
case "due_diligence":
return "IOI"
case "final_negotiation":
return "LOI"
case "dead":
return "Dead"
default:
return stage
}
}