Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mandado/9cdf11aae17d52a6237ea604b958be8a to your computer and use it in GitHub Desktop.

Select an option

Save mandado/9cdf11aae17d52a6237ea604b958be8a to your computer and use it in GitHub Desktop.

1. Create & Send Basic Invitations

Location in Code

// Service
service/event.go -> CreateEventInvitation()
service/email.go -> PublishEventInvitation()

// Models
model/event_invitation.go
model/event_invitation_event_guest.go

Available Endpoints

// Create invitation
POST /api/v1/events/create_invitation
Request {
    event_id: uint32
    user_ids: []uint32
    user_emails: []string
    group_ids: []uint32
    invitation_state: {
        new_invitation: {
            subject: string
            message: string
            file: FileDto (optional)
        }
        // OR
        existing_invitation: {
            event_invitation_id: uint32
        }
    }
}

2. RSVP System

Location In Code

// Service
service/event_guest.go -> RsvpToEvent()

// Repository
repository/event_guest.go -> GetByRsvpToken()
repository/event_guest.go -> RsvpToEvent()

// Models
model/rsvp.go (Enum: Pending, Yes, No, Maybe)

Available Endpoints

// RSVP to event
POST /api/v1/event-guests/rsvp
Request {
    rsvp_token: string
    first_name: string
    last_name: string
    phone_number: string
    rsvp_id: RsvpEnum
    additional_guests: [{
        first_name: string
        last_name: string
        email: string
    }]
}

// Get RSVP info
GET /api/v1/event-guests/rsvp-info
Request {
    rsvp_token: string
}

3. Plus-One Handling

Thoughts:

seems the same code from RSVP System section, area handling plus one handling.

Location In Code

// Service
service/event_guest.go -> RsvpToEvent()

// Repository
repository/event_guest.go -> GetByRsvpToken()
repository/event_guest.go -> RsvpToEvent()

// Models
model/rsvp.go (Enum: Pending, Yes, No, Maybe)

Available Endpoints

Available through RSVP endpoint (same as above)

4. Guest Statistics

Location In Code

// Service
service/event.go -> GetEventGuestStatistics()

// Models
model/event_invitation_event_guest.go (tracks RSVP status)

Available Endpoints

// Get guest statistics
GET /api/v1/events/{event_id}/guest-statistics
Response {
    total: uint32
    yes: uint32
    no: uint32
    maybe: uint32
    pending: uint32
}

5. Basic Group Management

Looking at the group model, we can link a guest to a group, but this group does not belong to any event.

Thoughts:

The model group has a column IsGuestGroup but doesn't have any direct reference to event. Can I create two groups with the same name but for different events or can be the same group from one event be reused on other event ?

Location in Code

// Models
model/event_guest.go -> UserGroupInternals relationship
model/user_group_internal.go

6. Email Delivery

Thoughts:

  • is implemented only service to publish event invitation and publish additional guest message.

Location in Code

// Service
service/email.go -> PublishEventInvitation()
service/email.go -> PublishAdditionalGuestMessage()

Templates

Templates are handled in the email service with the following data:

{
    link: string
    message: string
    event_name: string
    start_date: string
    start_time: string
    company_name: string
    event_image_url: string (optional)
    company_logo: string (optional)
    location: string (optional)
}

Extra notes:

They are using archived package: mapstructure ( github.com/mitchellh/mapstructure ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment