|
| 1 | +package models |
| 2 | + |
| 3 | +import "context" |
| 4 | + |
| 5 | +// VolunteeringHourLog represents a log of a volunteer's verified hours. |
| 6 | +type VolunteeringHourLog struct { |
| 7 | + Model |
| 8 | + OpportunityID int64 `json:"opportunityId"` |
| 9 | + Opportunity Opportunity `json:"-" gorm:"foreignkey:OpportunityID"` |
| 10 | + VolunteerID int64 `json:"volunteerId"` |
| 11 | + Volunteer User `json:"-" gorm:"foreignkey:VolunteerID"` |
| 12 | + GranterID int64 `json:"granterId"` |
| 13 | + Granter User `json:"-" gorm:"foreignkey:GranterID"` |
| 14 | + GrantedHours float32 `json:"grantedHours"` |
| 15 | +} |
| 16 | + |
| 17 | +// VolunteeringHourLogsResponse wraps an array of VolunteeringHourLogs and contains information from the database. |
| 18 | +type VolunteeringHourLogsResponse struct { |
| 19 | + VolunteeringHourLogs []VolunteeringHourLog |
| 20 | + TotalResults int |
| 21 | +} |
| 22 | + |
| 23 | +// VolunteeringHourLogRepository represents a repository of VolunteeringHourLog entities. |
| 24 | +type VolunteeringHourLogRepository interface { |
| 25 | + // FindByID finds a single entity by ID. |
| 26 | + FindByID(ctx context.Context, id int64) (*VolunteeringHourLog, error) |
| 27 | + // FindByOpportunityID finds multiple entities by the opportunity ID. |
| 28 | + FindByOpportunityID(ctx context.Context, opportunityID int64) (*VolunteeringHourLogsResponse, error) |
| 29 | + // FindByOpportunityIDs finds multiple entities by multiple opportunity IDs. |
| 30 | + FindByOpportunityIDs(ctx context.Context, opportunityIDs []int64) ([]Event, error) |
| 31 | + // FindByCreatorID finds multiple entities by the creator ID. |
| 32 | + FindByCreatorID(ctx context.Context, creatorID int64) ([]Event, error) |
| 33 | + // Create creates a new entity. |
| 34 | + Create(ctx context.Context, event Event) error |
| 35 | + // Update updates an entity with the ID in the provided entity. |
| 36 | + Update(ctx context.Context, event Event) error |
| 37 | + // DeleteByID deletes an entity by ID. |
| 38 | + DeleteByID(ctx context.Context, id int64) error |
| 39 | +} |
0 commit comments