Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

81 linhas
2.2KB

  1. package main
  2. import (
  3. "encoding/json"
  4. )
  5. type crmdMeetingAttendance struct {
  6. Status string `json:"status,omitempty"`
  7. }
  8. type crmdMeeting struct {
  9. crmdEntityBase
  10. Status string `json:"status,omitempty"`
  11. DateStart string `json:"dateStart,omitempty"`
  12. DateEnd string `json:"dateEnd,omitempty"`
  13. Duration int `json:"duration,omitempty"`
  14. Reminders []struct {
  15. Seconds int `json:"seconds,omitempty"`
  16. Type string `json:"type,omitempty"`
  17. } `json:"reminders,omitempty"`
  18. Venue string `json:"venue,omitempty"`
  19. ParentID string `json:"parentId,omitempty"`
  20. ParentType string `json:"parentType,omitempty"`
  21. ParentName string `json:"parentName,omitempty"`
  22. AccountID string `json:"accountId,omitempty"`
  23. AccountName string `json:"accountName,omitempty"`
  24. //users, attendance
  25. UsersIds []string `json:"usersIds,omitempty"`
  26. UsersNames map[string]string `json:"usersNames,omitempty"`
  27. UsersColumns map[string]crmdMeetingAttendance `json:"usersColumns"`
  28. //contacts, attendance
  29. ContactsIds []string `json:"contactsIds,omitempty"`
  30. ContactsNames map[string]string `json:"contactsNames,omitempty"`
  31. ContactsColumns map[string]crmdMeetingAttendance `json:"contactsColumns,omitempty"`
  32. //lead, attendance
  33. LeadsIds []string `json:"leadsIds,omitempty"`
  34. LeadsNames map[string]string `json:"leadsNames,omitempty"`
  35. LeadsColumns map[string]crmdMeetingAttendance `json:"leadsColumns"`
  36. //cover
  37. CoverID string `json:"coverId,omitempty"`
  38. CoverName string `json:"coverName,omitempty"`
  39. //for web spa operation
  40. spaErrMsg string
  41. }
  42. func (m crmdMeeting) save() (newMeeting crmdMeeting, err error) {
  43. jsonB, err := json.Marshal(m)
  44. if err != nil {
  45. return
  46. }
  47. if m.ID == "" { //create
  48. entity, e := crmCreateEntity("Meeting", jsonB)
  49. if e != nil {
  50. err = e
  51. return
  52. }
  53. newMeeting = entity.(crmdMeeting)
  54. } else { //patch
  55. entity, e := crmUpdateEntity("Meeting", m.ID, jsonB)
  56. if e != nil {
  57. err = e
  58. return
  59. }
  60. newMeeting = entity.(crmdMeeting)
  61. }
  62. return
  63. }
  64. func (m *crmdMeeting) setSpaErr(e string) {
  65. m.spaErrMsg = e
  66. }
  67. func (m crmdMeeting) ErrorMessage() string {
  68. return m.spaErrMsg
  69. }