Skip to content

Commit

Permalink
feat: add rsvp2 getbyid
Browse files Browse the repository at this point in the history
  • Loading branch information
adieos committed Apr 4, 2024
1 parent 18a7eaf commit da48728
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
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

0 comments on commit da48728

Please sign in to comment.