package common import ( "time" "github.com/google/uuid" ) type User struct { ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"` Email string `gorm:"unique;size:255" json:"email"` Name string `gorm:"size:255" json:"name"` PhoneNumber string `gorm:"size:50" json:"phone_number"` Password string `gorm:"size:255" json:"-"` PasswordCreated bool `gorm:"default:false" json:"password_created"` PasswordCreatedAt time.Time Role string `gorm:"size:50;default:member"` Status string `gorm:"size:50;default:active"` InvitedBy uuid.UUID `gorm:"type:uuid"` CreatedAt time.Time UpdatedAt time.Time Workspaces []Workspace `gorm:"many2many:user_workspace_roles;"` } type UserMe struct { User User `json:"user"` Workspaces []Workspace `json:"workspaces"` } // Invite represents an invitation to join the system. type Invite struct { ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"` Email string `gorm:"size:255" json:"email"` WorkspaceID uuid.UUID `gorm:"size:255" json:"workspace_id"` Role string `gorm:"size:50;default:member" json:"role"` Token string `gorm:"unique;size:255" json:"token"` Status string `gorm:"size:50;default:pending" json:"status"` ExpiresAt time.Time `json:"expires_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } type UserWorkspaceRole struct { UserID uuid.UUID `gorm:"primaryKey;type:uuid"` WorkspaceID uuid.UUID `gorm:"primaryKey;type:uuid"` Role string `gorm:"size:50;default:member"` CreatedAt time.Time UpdatedAt time.Time // Optional: Add these if you want GORM to handle the relationships User User `gorm:"foreignKey:UserID"` Workspace Workspace `gorm:"foreignKey:WorkspaceID"` } type CreateOwnerResponse struct { User User `json:"user"` Token string `json:"token"` } type InitWorkspaceOwnerRequest struct { Email string `json:"email"` Name string `json:"name"` Phone string `json:"phone_number"` } type CreateInvitedUserRequest struct { Email string `json:"email"` Name string `json:"name"` PhoneNumber string `json:"phone_number"` Password string `json:"password"` Token string `json:"token"` } type CreateInvitedUserResponse struct { User User `json:"user"` Worspace string `json:"workspace_id"` } type InviteUserRequest struct { Email string `json:"email"` Workspace string `json:"workspace_id"` Role string `json:"role"` } type ValidateInvitedUserRequest struct { Valid bool `json:"valid"` WorkspaceID string `json:"workspace_id"` Email string `json:"email"` Error string `json:"error"` }