Skip to content

Commit

Permalink
Prepare construct legacy events
Browse files Browse the repository at this point in the history
  • Loading branch information
petyos committed Jan 19, 2024
1 parent 91c8d96 commit 8313bab
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 92 deletions.
38 changes: 7 additions & 31 deletions core/logic_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,31 +127,7 @@ func (e eventsLogic) getAllEvents() ([]model.WebToolsEventItem, error) {
if w.WebToolsEvent != nil {
for _, g := range w.WebToolsEvent {

var isVirtual bool
if g.VirtualEvent == "false" {
isVirtual = false
} else if g.VirtualEvent == "true" {
isVirtual = true
}

var IsEventFree bool
if g.CostFree == "false" {
IsEventFree = false
} else if g.CostFree == "true" {
IsEventFree = true
}

var Recurrence bool
if g.Recurrence == "false" {
Recurrence = false
} else if g.Recurrence == "true" {
Recurrence = true
}

event := model.LegacyEvent{RecurringFlag: Recurrence, /* RegistrationURL: &g.RegistrationURL, TitleURL: &g.TitleURL*/
LongDescription: g.Description, IsEventFree: IsEventFree, AllDay: false, SourceID: "0",
CalendarID: g.CalendarID, Title: g.Title, Sponsor: g.Sponsor, DataSourceEventID: g.EventID,
IsVirtial: isVirtual, OriginatingCalendarID: g.OriginatingCalendarID, Category: g.EventType}
event := e.constructLegacyEvents(g)
legacyEvent = append(legacyEvent, event)
}
}
Expand All @@ -163,8 +139,7 @@ func (e eventsLogic) getAllEvents() ([]model.WebToolsEventItem, error) {
return allevents, nil
}

func (e eventsLogic) constructLegacyEvents(webToolsEvent model.WebToolsEventItem) model.LegacyEvent {
/*g := webToolsEvent.PublicEventWS
func (e eventsLogic) constructLegacyEvents(g model.WebToolsEvent) model.LegacyEvent {

var isVirtual bool
if g.VirtualEvent == "false" {
Expand All @@ -188,10 +163,11 @@ func (e eventsLogic) constructLegacyEvents(webToolsEvent model.WebToolsEventItem
}

event := model.LegacyEvent{RecurringFlag: Recurrence, /* RegistrationURL: &g.RegistrationURL, TitleURL: &g.TitleURL*/
// LongDescription: g.Description, IsEventFree: IsEventFree, AllDay: false, SourceID: "0",
// CalendarID: g.CalendarID, Title: g.Title, Sponsor: g.Sponsor, DataSourceEventID: g.EventID,
// IsVirtial: isVirtual, OriginatingCalendarID: g.OriginatingCalendarID, Category: g.EventType} */
return model.LegacyEvent{}
LongDescription: g.Description, IsEventFree: IsEventFree, AllDay: false, SourceID: "0",
CalendarID: g.CalendarID, Title: g.Title, Sponsor: g.Sponsor, DataSourceEventID: g.EventID,
IsVirtial: isVirtual, OriginatingCalendarID: g.OriginatingCalendarID, Category: g.EventType}

return event
}

// newAppEventsLogic creates new appShared
Expand Down
125 changes: 64 additions & 61 deletions core/model/legacyEvents.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,68 +26,71 @@ const (
TypeLegacyEvents logutils.MessageDataType = "legacy_events"
)

// WebToolsEventItem represents web tools item
// WebToolsEventItem represents web tools event wrapper item
type WebToolsEventItem struct {
XMLName xml.Name `xml:"responseWS"`
Text string `xml:",chardata"`
Deprecated string `xml:"deprecated"`
MaxPageSize string `xml:"maxPageSize"`
WebToolsEvent []struct {
Text string `xml:",chardata"`
CalendarID string `xml:"calendarId"`
CalendarName string `xml:"calendarName"`
EventID string `xml:"eventId"`
Recurrence string `xml:"recurrence"`
RecurrenceID string `xml:"recurrenceId"`
OriginatingCalendarID string `xml:"originatingCalendarId"`
OriginatingCalendarName string `xml:"originatingCalendarName"`
Title string `xml:"title"`
TitleURL string `xml:"titleURL"`
EventType string `xml:"eventType"`
Sponsor string `xml:"sponsor"`
DateDisplay string `xml:"dateDisplay"`
StartDate string `xml:"startDate"`
EndDate string `xml:"endDate"`
TimeType string `xml:"timeType"`
StartTime string `xml:"startTime"`
EndTime string `xml:"endTime"`
EndTimeLabel string `xml:"endTimeLabel"`
InPersonEvent string `xml:"inPersonEvent"`
Location string `xml:"location"`
Description string `xml:"description"`
Speaker string `xml:"speaker"`
RegistrationLabel string `xml:"registrationLabel"`
RegistrationURL string `xml:"registrationURL"`
ContactName string `xml:"contactName"`
ContactEmail string `xml:"contactEmail"`
ContactPhone string `xml:"contactPhone"`
CostFree string `xml:"costFree"`
Cost string `xml:"cost"`
CreatedBy string `xml:"createdBy"`
CreatedDate string `xml:"createdDate"`
EditedBy string `xml:"editedBy"`
EditedDate string `xml:"editedDate"`
Summary string `xml:"summary"`
AudienceFacultyStaff string `xml:"audienceFacultyStaff"`
AudienceStudents string `xml:"audienceStudents"`
AudiencePublic string `xml:"audiencePublic"`
AudienceAlumni string `xml:"audienceAlumni"`
AudienceParents string `xml:"audienceParents"`
ShareWithUrbanaEventsInChicagoArea string `xml:"shareWithUrbanaEventsInChicagoArea"`
ShareWithResearch string `xml:"shareWithResearch"`
ShareWithSpeakers string `xml:"shareWithSpeakers"`
ShareWithIllinoisMobileApp string `xml:"shareWithIllinoisMobileApp"`
ThumbImageUploaded string `xml:"thumbImageUploaded"`
LargeImageUploaded string `xml:"largeImageUploaded"`
LargeImageSize string `xml:"largeImageSize"`
VirtualEvent string `xml:"virtualEvent"`
VirtualEventURL string `xml:"virtualEventURL"`
Topic []struct {
Text string `xml:",chardata"`
ID string `xml:"id"`
Name string `xml:"name"`
} `xml:"topic"`
} `xml:"publicEventWS"`
XMLName xml.Name `xml:"responseWS"`
Text string `xml:",chardata"`
Deprecated string `xml:"deprecated"`
MaxPageSize string `xml:"maxPageSize"`
WebToolsEvent []WebToolsEvent `xml:"publicEventWS"`
}

// WebToolsEvent represents web tools event entity
type WebToolsEvent struct {
Text string `xml:",chardata"`
CalendarID string `xml:"calendarId"`
CalendarName string `xml:"calendarName"`
EventID string `xml:"eventId"`
Recurrence string `xml:"recurrence"`
RecurrenceID string `xml:"recurrenceId"`
OriginatingCalendarID string `xml:"originatingCalendarId"`
OriginatingCalendarName string `xml:"originatingCalendarName"`
Title string `xml:"title"`
TitleURL string `xml:"titleURL"`
EventType string `xml:"eventType"`
Sponsor string `xml:"sponsor"`
DateDisplay string `xml:"dateDisplay"`
StartDate string `xml:"startDate"`
EndDate string `xml:"endDate"`
TimeType string `xml:"timeType"`
StartTime string `xml:"startTime"`
EndTime string `xml:"endTime"`
EndTimeLabel string `xml:"endTimeLabel"`
InPersonEvent string `xml:"inPersonEvent"`
Location string `xml:"location"`
Description string `xml:"description"`
Speaker string `xml:"speaker"`
RegistrationLabel string `xml:"registrationLabel"`
RegistrationURL string `xml:"registrationURL"`
ContactName string `xml:"contactName"`
ContactEmail string `xml:"contactEmail"`
ContactPhone string `xml:"contactPhone"`
CostFree string `xml:"costFree"`
Cost string `xml:"cost"`
CreatedBy string `xml:"createdBy"`
CreatedDate string `xml:"createdDate"`
EditedBy string `xml:"editedBy"`
EditedDate string `xml:"editedDate"`
Summary string `xml:"summary"`
AudienceFacultyStaff string `xml:"audienceFacultyStaff"`
AudienceStudents string `xml:"audienceStudents"`
AudiencePublic string `xml:"audiencePublic"`
AudienceAlumni string `xml:"audienceAlumni"`
AudienceParents string `xml:"audienceParents"`
ShareWithUrbanaEventsInChicagoArea string `xml:"shareWithUrbanaEventsInChicagoArea"`
ShareWithResearch string `xml:"shareWithResearch"`
ShareWithSpeakers string `xml:"shareWithSpeakers"`
ShareWithIllinoisMobileApp string `xml:"shareWithIllinoisMobileApp"`
ThumbImageUploaded string `xml:"thumbImageUploaded"`
LargeImageUploaded string `xml:"largeImageUploaded"`
LargeImageSize string `xml:"largeImageSize"`
VirtualEvent string `xml:"virtualEvent"`
VirtualEventURL string `xml:"virtualEventURL"`
Topic []struct {
Text string `xml:",chardata"`
ID string `xml:"id"`
Name string `xml:"name"`
} `xml:"topic"`
}

// LegacyEvent wrapper
Expand Down

0 comments on commit 8313bab

Please sign in to comment.