e8beb7d4f3
- Navigation: new per-user setting (default "side") renders the page links as a left sidebar while keeping theme/bell/avatar/logout in the top-right; falls back to a top bar under 760px or when set to "top". Profile selector added. - Group conversations: record a creatorId; the creator gets a "Manage members" button to add/remove participants (new GET/POST/DELETE members endpoints, creator-only). Existing groups backfilled. - Customer ticketing: admin can map each assigned consultant to their username in that customer's ticketing system. Per-customer mapping takes precedence over the consultant's global ticketingIdentities during sync. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
63 lines
2.3 KiB
Go
63 lines
2.3 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type TicketingType string
|
|
|
|
const (
|
|
TicketingJira TicketingType = "jira"
|
|
TicketingAzure TicketingType = "azure_devops"
|
|
TicketingYouTrack TicketingType = "youtrack"
|
|
TicketingWekan TicketingType = "wekan"
|
|
// TicketingDemo fabricates tickets locally so the whole flow works
|
|
// offline (§11.11).
|
|
TicketingDemo TicketingType = "demo"
|
|
)
|
|
|
|
func (t TicketingType) Valid() bool {
|
|
switch t {
|
|
case TicketingJira, TicketingAzure, TicketingYouTrack, TicketingWekan, TicketingDemo:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
type Ticketing struct {
|
|
Type TicketingType `bson:"type" json:"type"`
|
|
BaseURL string `bson:"baseUrl" json:"baseUrl"`
|
|
CredentialsEnc string `bson:"credentialsEnc" json:"-"`
|
|
ProjectKey string `bson:"projectKey" json:"projectKey"`
|
|
PollIntervalSec int `bson:"pollIntervalSec" json:"pollIntervalSec"`
|
|
// ConsultantIdentities maps a bounty-board consultant id to that
|
|
// consultant's username in THIS customer's ticketing system. It takes
|
|
// precedence over the consultant's global extra.ticketingIdentities so an
|
|
// admin can map accounts per project (§5.3).
|
|
ConsultantIdentities map[string]string `bson:"consultantIdentities,omitempty" json:"consultantIdentities,omitempty"`
|
|
LastSyncAt time.Time `bson:"lastSyncAt" json:"lastSyncAt"`
|
|
LastSyncStatus string `bson:"lastSyncStatus" json:"lastSyncStatus"` // "", ok, error
|
|
LastSyncError string `bson:"lastSyncError" json:"lastSyncError"`
|
|
}
|
|
|
|
// Customer == "project" in the UI (§4.2).
|
|
type Customer struct {
|
|
ID string `bson:"_id" json:"id"`
|
|
Name string `bson:"name" json:"name"`
|
|
Ticketing Ticketing `bson:"ticketing" json:"ticketing"`
|
|
ConsultantIDs []string `bson:"consultantIds" json:"consultantIds"`
|
|
DefaultBudget float64 `bson:"defaultBudget" json:"defaultBudget"`
|
|
Archived bool `bson:"archived" json:"archived"`
|
|
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
|
|
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
|
|
Version int64 `bson:"version" json:"version"`
|
|
}
|
|
|
|
// HasConsultant reports membership in the customer's consultant set.
|
|
func (c *Customer) HasConsultant(userID string) bool {
|
|
for _, id := range c.ConsultantIDs {
|
|
if id == userID {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|