Documentation
¶
Index ¶
- type Category
- type CreateInput
- type CreateTopicOpts
- type PgRepo
- func (r *PgRepo) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PgRepo) FindByID(ctx context.Context, id uuid.UUID) (*Topic, error)
- func (r *PgRepo) FindByOwner(ctx context.Context, id uuid.UUID) ([]Topic, error)
- func (r *PgRepo) FindInvolved(ctx context.Context, id uuid.UUID) ([]Topic, error)
- func (r *PgRepo) Save(ctx context.Context, t *Topic) error
- func (r *PgRepo) Update(ctx context.Context, t *Topic) error
- type Repo
- type Routes
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateInput ¶
type CreateTopicOpts ¶
type CreateTopicOpts struct {
Category Category `json:"category"`
Title string `json:"title"`
Capacity int `json:"capacity"`
Owner uuid.UUID `json:"owner"`
}
CreateTopicOpts are options struct to create a new Topic
type PgRepo ¶
type PgRepo struct {
// contains filtered or unexported fields
}
func (*PgRepo) FindByOwner ¶
func (*PgRepo) FindInvolved ¶
type Repo ¶
type Repo interface {
Save(ctx context.Context, t *Topic) error
FindByID(ctx context.Context, id uuid.UUID) (*Topic, error)
FindByOwner(ctx context.Context, id uuid.UUID) ([]Topic, error)
FindInvolved(ctx context.Context, id uuid.UUID) ([]Topic, error)
Update(ctx context.Context, t *Topic) error
Delete(ctx context.Context, id uuid.UUID) error
}
type Routes ¶
type Routes struct {
// contains filtered or unexported fields
}
func (*Routes) Create ¶
Create
@ID Topic-Create @Summary Create Topic @Tags topics @Security BearerAuth @Accept json @Produce json @Param options body CreateInput true "New Topic Information" @Success 201 @Failure 400 @Failure 500 @Router /topics [post]
func (*Routes) Delete ¶
Delete
@ID Topic-Delete
@Summary Delete Topic
@Tags topics
@Security BearerAuth
@Produce json
@Param id path string true "Topic ID"
@Success 200
@Failure 400
@Failure 404
@Failure 500
@Router /topics/{id} [delete]
func (*Routes) FindByID ¶
FindByID
@ID Topic-Find
@Summary Find Topic By ID
@Tags topics
@Produce json
@Param id path string true "Topic ID"
@Success 200 {object} Topic
@Failure 400
@Failure 404
@Failure 500
@Router /topics/{id} [get]
func (*Routes) FindByOwnerID ¶
FindByOwnerID
@ID Topic-Find-Owned
@Summary Find Topics By Owner ID
@Tags topics
@Produce json
@Param id path string true "Owner ID"
@Success 200 {object} []Topic
@Failure 400
@Failure 500
@Router /topics/owner/{id} [get]
func (*Routes) FindInvolved ¶
FindInvolved
@ID Topic-Find-Paired
@Summary Find Paired Topics By User ID
@Tags topics
@Produce json
@Param id path string true "Involved ID"
@Success 200 {object} []Topic
@Failure 400
@Failure 500
@Router /topics/pair/{id} [get]
type Topic ¶
type Topic struct {
ID uuid.UUID `json:"id"`
Category Category `json:"category"`
Title string `json:"title"`
// Max expected parties
Capacity int `json:"capacity"`
// ID of the owner User
Owner uuid.UUID `json:"owner"`
// IDs of invloved Users
Parties []uuid.UUID `json:"parties"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
FinishedAt time.Time `json:"finished_at"`
}
Topic represents a topic to study and ID's of users involved
func CreateTopic ¶
func CreateTopic(opts CreateTopicOpts) Topic
CreateTopic creates a new Topic with new ID
func (*Topic) IsFinished ¶
func (*Topic) RemoveParties ¶
func (*Topic) UpdateCapacity ¶
Click to show internal directories.
Click to hide internal directories.