feat: add jira filter url per participant and meeting jira url
This commit is contained in:
@@ -18,12 +18,13 @@ import (
|
||||
)
|
||||
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
store *storage.Storage
|
||||
timer *timer.Timer
|
||||
session *models.MeetingSession
|
||||
currentLogs map[uint]*models.ParticipantLog
|
||||
updater *updater.Updater
|
||||
ctx context.Context
|
||||
store *storage.Storage
|
||||
timer *timer.Timer
|
||||
session *models.MeetingSession
|
||||
currentLogs map[uint]*models.ParticipantLog
|
||||
participantURLs map[uint]string
|
||||
updater *updater.Updater
|
||||
}
|
||||
|
||||
func New(store *storage.Storage) *App {
|
||||
@@ -85,16 +86,17 @@ func (a *App) GetParticipants() ([]models.Participant, error) {
|
||||
return a.store.GetParticipants()
|
||||
}
|
||||
|
||||
func (a *App) AddParticipant(name string, email string, timeLimit int) (*models.Participant, error) {
|
||||
func (a *App) AddParticipant(name string, email string, timeLimit int, jiraFilter string) (*models.Participant, error) {
|
||||
participants, _ := a.store.GetAllParticipants()
|
||||
order := len(participants)
|
||||
|
||||
p := &models.Participant{
|
||||
Name: name,
|
||||
Email: email,
|
||||
TimeLimit: timeLimit,
|
||||
Order: order,
|
||||
Active: true,
|
||||
Name: name,
|
||||
Email: email,
|
||||
JiraFilter: jiraFilter,
|
||||
TimeLimit: timeLimit,
|
||||
Order: order,
|
||||
Active: true,
|
||||
}
|
||||
|
||||
if err := a.store.CreateParticipant(p); err != nil {
|
||||
@@ -103,12 +105,13 @@ func (a *App) AddParticipant(name string, email string, timeLimit int) (*models.
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (a *App) UpdateParticipant(id uint, name string, email string, timeLimit int) error {
|
||||
func (a *App) UpdateParticipant(id uint, name string, email string, timeLimit int, jiraFilter string) error {
|
||||
p := &models.Participant{
|
||||
ID: id,
|
||||
Name: name,
|
||||
Email: email,
|
||||
TimeLimit: timeLimit,
|
||||
ID: id,
|
||||
Name: name,
|
||||
Email: email,
|
||||
JiraFilter: jiraFilter,
|
||||
TimeLimit: timeLimit,
|
||||
}
|
||||
return a.store.UpdateParticipant(p)
|
||||
}
|
||||
@@ -127,13 +130,14 @@ func (a *App) GetMeeting() (*models.Meeting, error) {
|
||||
return a.store.GetMeeting()
|
||||
}
|
||||
|
||||
func (a *App) UpdateMeeting(name string, timeLimit int) error {
|
||||
func (a *App) UpdateMeeting(name string, timeLimit int, jiraURL string) error {
|
||||
meeting, err := a.store.GetMeeting()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
meeting.Name = name
|
||||
meeting.TimeLimit = timeLimit
|
||||
meeting.JiraURL = jiraURL
|
||||
return a.store.UpdateMeeting(meeting)
|
||||
}
|
||||
|
||||
@@ -181,6 +185,17 @@ func (a *App) StartMeeting(participantOrder []uint, attendance map[uint]bool) er
|
||||
}
|
||||
}
|
||||
|
||||
a.participantURLs = make(map[uint]string)
|
||||
if meeting.JiraURL != "" {
|
||||
for _, p := range participants {
|
||||
url := meeting.JiraURL
|
||||
if p.JiraFilter != "" {
|
||||
url = meeting.JiraURL + "&quickFilter=" + p.JiraFilter
|
||||
}
|
||||
a.participantURLs[p.ID] = url
|
||||
}
|
||||
}
|
||||
|
||||
a.timer = timer.New(meeting.TimeLimit, warningThreshold)
|
||||
a.timer.SetQueue(queue)
|
||||
a.currentLogs = make(map[uint]*models.ParticipantLog)
|
||||
@@ -205,6 +220,9 @@ func (a *App) handleTimerEvents() {
|
||||
runtime.EventsEmit(a.ctx, "timer:meeting_timeup", event.State)
|
||||
case timer.EventSpeakerChanged:
|
||||
a.saveSpeakerLog(event.State)
|
||||
if url, ok := a.participantURLs[event.State.CurrentSpeakerID]; ok && url != "" {
|
||||
runtime.BrowserOpenURL(a.ctx, url)
|
||||
}
|
||||
runtime.EventsEmit(a.ctx, "timer:speaker_changed", event.State)
|
||||
case timer.EventMeetingEnded:
|
||||
a.finalizeSpeakerLogs(event.State)
|
||||
|
||||
@@ -5,19 +5,21 @@ import (
|
||||
)
|
||||
|
||||
type Participant struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
Name string `json:"name" gorm:"not null"`
|
||||
Email string `json:"email,omitempty"`
|
||||
TimeLimit int `json:"timeLimit" gorm:"default:120"` // seconds
|
||||
Order int `json:"order" gorm:"default:0"`
|
||||
Active bool `json:"active" gorm:"default:true"`
|
||||
CreatedAt time.Time `json:"createdAt" tsType:"string"`
|
||||
UpdatedAt time.Time `json:"updatedAt" tsType:"string"`
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
Name string `json:"name" gorm:"not null"`
|
||||
Email string `json:"email,omitempty"`
|
||||
JiraFilter string `json:"jiraFilter,omitempty"`
|
||||
TimeLimit int `json:"timeLimit" gorm:"default:120"` // seconds
|
||||
Order int `json:"order" gorm:"default:0"`
|
||||
Active bool `json:"active" gorm:"default:true"`
|
||||
CreatedAt time.Time `json:"createdAt" tsType:"string"`
|
||||
UpdatedAt time.Time `json:"updatedAt" tsType:"string"`
|
||||
}
|
||||
|
||||
type Meeting struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
Name string `json:"name" gorm:"not null;default:Daily Standup"`
|
||||
JiraURL string `json:"jiraUrl,omitempty"`
|
||||
TimeLimit int `json:"timeLimit" gorm:"default:3600"` // total meeting limit in seconds (1 hour)
|
||||
Sessions []MeetingSession `json:"sessions,omitempty" gorm:"foreignKey:MeetingID"`
|
||||
CreatedAt time.Time `json:"createdAt" tsType:"string"`
|
||||
|
||||
@@ -117,9 +117,10 @@ func (s *Storage) CreateParticipant(p *models.Participant) error {
|
||||
|
||||
func (s *Storage) UpdateParticipant(p *models.Participant) error {
|
||||
return s.db.Model(&models.Participant{}).Where("id = ?", p.ID).Updates(map[string]interface{}{
|
||||
"name": p.Name,
|
||||
"email": p.Email,
|
||||
"time_limit": p.TimeLimit,
|
||||
"name": p.Name,
|
||||
"email": p.Email,
|
||||
"jira_filter": p.JiraFilter,
|
||||
"time_limit": p.TimeLimit,
|
||||
}).Error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user