infrastructure

package
v0.0.0-...-2033fae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePollHandler

func CreatePollHandler(ctx *gin.Context)

func CreateVoteHandler

func CreateVoteHandler(ctx *gin.Context)

func GetAllPollsHandler

func GetAllPollsHandler(ctx *gin.Context)

func GetPollByCodeHandler

func GetPollByCodeHandler(ctx *gin.Context)

func InitApi

func InitApi()

Types

type AlternativeVM

type AlternativeVM struct {
	ID   uint   `json:"id"`
	Text string `json:"text"`
}

type PollRepository

type PollRepository struct{}

func (*PollRepository) Create

func (r *PollRepository) Create(poll domain.Poll) (domain.Poll, error)

func (*PollRepository) GetAll

func (r *PollRepository) GetAll() ([]domain.Poll, error)

func (*PollRepository) GetByCode

func (r *PollRepository) GetByCode(code string) (domain.Poll, error)

func (*PollRepository) GetResults

func (r *PollRepository) GetResults(id uint) (domain.Poll, error)

type PollResultsVM

type PollResultsVM struct {
	Question     string          `json:"question"`
	Alternatives []AlternativeVM `json:"alternatives"`
	Votes        []uint          `json:"votes"`
}

type PollVM

type PollVM struct {
	ID           uint            `json:"id"`
	Question     string          `json:"question"`
	Alternatives []AlternativeVM `json:"alternatives"`
	UserID       uint            `json:"user_id"`
	Code         string          `json:"code"`
}

type VoteRepository

type VoteRepository struct{}

func (*VoteRepository) Create

func (r *VoteRepository) Create(vote domain.Vote) (domain.Vote, error)

type VoteVM

type VoteVM struct {
	AlternativeID uint `json:"alternative_id"`
	UserID        uint `json:"user_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL