feat: add calendar scheduling feature for agent teams

- Implemented FindCalendarSchedules method in agentTeamScheduleService to retrieve schedules within a specified time range.
- Added new API endpoint fetchAgentTeamScheduleCalendar to fetch schedules for the calendar view.
- Created ScheduleCalendar component to display agent team schedules in a calendar format with drag-and-drop functionality for moving and resizing schedules.
- Updated EditDialog component to support deleting schedules and handling default values for new entries.
- Enhanced DashboardAgentTeamSchedulesPage to toggle between calendar and list views, and to load calendar data based on selected week.
- Added tests for FindCalendarSchedules to ensure correct schedule retrieval and validation of time ranges.
This commit is contained in:
mlogclub
2026-04-29 09:23:54 +08:00
parent ce8a8d5bcc
commit 8646b002c1
10 changed files with 895 additions and 139 deletions
@@ -53,6 +53,21 @@ func (s *agentTeamScheduleService) Count(cnd *sqls.Cnd) int64 {
return repositories.AgentTeamScheduleRepository.Count(sqls.DB(), cnd)
}
func (s *agentTeamScheduleService) FindCalendarSchedules(req request.AgentTeamScheduleCalendarRequest) ([]models.AgentTeamSchedule, error) {
startAtValue, err := parseRequiredDateTime(req.StartAt, "开始时间格式错误")
if err != nil {
return nil, err
}
endAtValue, err := parseRequiredDateTime(req.EndAt, "结束时间格式错误")
if err != nil {
return nil, err
}
if !endAtValue.After(startAtValue) {
return nil, errorsx.InvalidParam("结束时间必须晚于开始时间")
}
return repositories.AgentTeamScheduleRepository.FindByTimeRange(sqls.DB(), startAtValue, endAtValue, req.TeamID), nil
}
func (s *agentTeamScheduleService) Create(t *models.AgentTeamSchedule) error {
return repositories.AgentTeamScheduleRepository.Create(sqls.DB(), t)
}