fix: keep workbench user ids compatible
This commit is contained in:
+11
-11
@@ -54,7 +54,7 @@ func organizationMemberPayloads(members []store.OrganizationMember) []map[string
|
||||
|
||||
func organizationMemberPayload(member store.OrganizationMember) map[string]any {
|
||||
payload := map[string]any{
|
||||
"user_id": member.UserID,
|
||||
"user_id": formatUserID(member.UserID),
|
||||
"department_id": member.DepartmentID,
|
||||
"display_name": member.DisplayName,
|
||||
"position": member.Position,
|
||||
@@ -133,7 +133,7 @@ func attendanceRecordPayload(record *store.AttendanceRecord) map[string]any {
|
||||
}
|
||||
return map[string]any{
|
||||
"record_id": record.RecordID,
|
||||
"user_id": record.UserID,
|
||||
"user_id": formatUserID(record.UserID),
|
||||
"date": record.Date.Format("2006-01-02"),
|
||||
"rule_id": record.RuleID,
|
||||
"shift_id": record.ShiftID,
|
||||
@@ -195,7 +195,7 @@ func attendanceAppealPayload(appeal *store.AttendanceAppeal) map[string]any {
|
||||
data := map[string]any{
|
||||
"appeal_id": appeal.AppealID,
|
||||
"record_id": appeal.RecordID,
|
||||
"user_id": appeal.UserID,
|
||||
"user_id": formatUserID(appeal.UserID),
|
||||
"appeal_type": appeal.AppealType,
|
||||
"reason": appeal.Reason,
|
||||
"target_action": appeal.TargetAction,
|
||||
@@ -229,9 +229,9 @@ func meetingPayload(meeting store.Meeting, viewer int64) map[string]any {
|
||||
data := map[string]any{
|
||||
"meeting_id": meeting.MeetingID,
|
||||
"title": meeting.Title,
|
||||
"organizer_id": meeting.OrganizerID,
|
||||
"organizer_id": formatUserID(meeting.OrganizerID),
|
||||
"organizer": userSummary(meeting.OrganizerID),
|
||||
"recorder_user_id": recorderID,
|
||||
"recorder_user_id": formatUserID(recorderID),
|
||||
"recorder": userSummary(recorderID),
|
||||
"start_at": meeting.StartAt.UTC().Format(time.RFC3339Nano),
|
||||
"end_at": meeting.EndAt.UTC().Format(time.RFC3339Nano),
|
||||
@@ -263,7 +263,7 @@ func meetingPayload(meeting store.Meeting, viewer int64) map[string]any {
|
||||
func meetingParticipantPayloads(participants []store.MeetingParticipant) []map[string]any {
|
||||
items := make([]map[string]any, 0, len(participants))
|
||||
for _, participant := range participants {
|
||||
item := map[string]any{"user_id": participant.UserID, "response": participant.Response}
|
||||
item := map[string]any{"user_id": formatUserID(participant.UserID), "response": participant.Response}
|
||||
if participant.ResponseAt != nil {
|
||||
item["response_at"] = participant.ResponseAt.UTC().Format(time.RFC3339Nano)
|
||||
}
|
||||
@@ -318,7 +318,7 @@ func meetingNoteFilePayload(file store.MeetingNoteFile, viewer int64) map[string
|
||||
"preview_status": file.PreviewStatus,
|
||||
"preview_mode": file.PreviewMode,
|
||||
"preview_file_id": file.PreviewFileID,
|
||||
"uploader_user_id": file.UploaderID,
|
||||
"uploader_user_id": formatUserID(file.UploaderID),
|
||||
"uploader": userSummary(file.UploaderID),
|
||||
"version": file.Version,
|
||||
"permissions": map[string]any{
|
||||
@@ -343,7 +343,7 @@ func dailyReportPayloads(reports []store.DailyReport) []map[string]any {
|
||||
func dailyReportPayload(report store.DailyReport) map[string]any {
|
||||
data := map[string]any{
|
||||
"report_id": report.ReportID,
|
||||
"author_id": report.AuthorID,
|
||||
"author_id": formatUserID(report.AuthorID),
|
||||
"report_date": report.ReportDate.Format("2006-01-02"),
|
||||
"content": report.Content,
|
||||
"content_short": preview(report.Content),
|
||||
@@ -372,7 +372,7 @@ func monthlyReportPayloads(reports []store.MonthlyReport) []map[string]any {
|
||||
func monthlyReportPayload(report store.MonthlyReport) map[string]any {
|
||||
data := map[string]any{
|
||||
"report_id": report.ReportID,
|
||||
"author_id": report.AuthorID,
|
||||
"author_id": formatUserID(report.AuthorID),
|
||||
"month": report.Month,
|
||||
"work_summary": report.WorkSummary,
|
||||
"next_plan": report.NextPlan,
|
||||
@@ -408,7 +408,7 @@ func mailboxConfigPayload(config store.MailboxConfig) map[string]any {
|
||||
func mailboxSubmissionPayload(submission store.MailboxSubmission) map[string]any {
|
||||
return map[string]any{
|
||||
"submission_id": submission.SubmissionID,
|
||||
"sender_id": submission.SenderID,
|
||||
"sender_id": formatUserID(submission.SenderID),
|
||||
"subject": submission.Subject,
|
||||
"anonymous": submission.Anonymous,
|
||||
"attachment_file_ids": jsonList(submission.AttachmentFileIDs),
|
||||
@@ -439,7 +439,7 @@ func meetingNotePermissions(meeting store.Meeting, viewer int64) map[string]any
|
||||
}
|
||||
|
||||
func userSummary(userID int64) map[string]any {
|
||||
return map[string]any{"user_id": userID, "display_name": userID}
|
||||
return map[string]any{"user_id": formatUserID(userID), "display_name": formatUserID(userID)}
|
||||
}
|
||||
|
||||
func jsonList(raw string) []any {
|
||||
|
||||
Reference in New Issue
Block a user