Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pe-2 rsvp GetById #18

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions repository/pe-2-rsvp.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type (
Create(entity.PE2RSVP) (entity.PE2RSVP, error)
CheckEmailExist(string) (bool, error)
GetAllPagination(string, int, int) ([]entity.PE2RSVP, int64, int64, error)
GetById(string) (entity.PE2RSVP, error)
CountTotal() (int64, error)
CountAttends() (int64, error)
}
Expand Down Expand Up @@ -92,3 +93,11 @@ func (r *pe2RSVPRepository) CountAttends() (int64, error) {

return count, nil
}

func (r *pe2RSVPRepository) GetById(id string) (entity.PE2RSVP, error) {
var attendee entity.PE2RSVP
if err := r.db.Where("id = ?", id).Take(&attendee).Error; err != nil {
return entity.PE2RSVP{}, err
}
return attendee, nil
}
23 changes: 14 additions & 9 deletions service/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,21 @@ func (s *ticketService) GetPE2RSVPPaginated(ctx context.Context, req dto.Paginat
}

func (s *ticketService) GetPE2RSVPDetail(ctx context.Context, id string) (dto.TicketPE2RSVPResponse, error) {
attendee, err := s.pe2RSVPRepo.GetById(id)
if err != nil {
return dto.TicketPE2RSVPResponse{}, err
}

return dto.TicketPE2RSVPResponse{
Name: "UNDER CONSTRUCTION",
Email: "[email protected]",
Institute: "UNDER CONSTRUCTION",
Department: "UNDER CONSTRUCTION",
StudentID: "UNDER CONSTRUCTION",
Batch: "UNDER CONSTRUCTION",
WillingToCome: true,
WillingToBeContacted: true,
Essay: "UNDER CONSTRUCTION",
Name: attendee.Name,
Email: attendee.Email,
Institute: attendee.Institute,
Department: attendee.Department,
StudentID: attendee.StudentID,
Batch: attendee.Batch,
WillingToCome: *attendee.WillingToCome,
WillingToBeContacted: *attendee.WillingToBeContacted,
Essay: attendee.Essay,
}, nil
}

Expand Down
Loading