Passed
Pull Request — main (#71)
by Yume
01:16
created

models.*TodayResponse.AppendDeckResponse   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package models
2
3
import (
4
	"gorm.io/gorm"
5
)
6
7
// Answer structure
8
type Answer struct {
9
	gorm.Model
10
	CardID uint `json:"card_id" example:"1"`
11
	Card   Card
12
	Answer string `json:"answer" example:"42"`
13
}
14
15
// DeckResponse structure
16
type DeckResponse struct {
17
	DeckID uint           `json:"deck_id"`
18
	Deck   Deck           `json:"deck"`
19
	Cards  []ResponseCard `json:"cards"`
20
	Count  int            `json:"count"`
21
}
22
23
type TodayResponse struct {
24
	DecksReponses []DeckResponse `json:"decks_responses"`
25
	Count         int            `json:"count"`
26
}
27
28
func (today *TodayResponse) AppendDeckResponse(deckResponse DeckResponse) {
29
	today.DecksReponses = append(today.DecksReponses, deckResponse)
30
}
31