From 5e82855ac67d37354b73b1e3e4bd57d5a6e740c8 Mon Sep 17 00:00:00 2001
From: Alexis Poyen <apoyen@mail.apoyen.fr>
Date: Wed, 6 May 2020 13:46:11 +0200
Subject: [PATCH] Feat : link a round with candidateLists and area reference

---
 internal/models/models.go | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/internal/models/models.go b/internal/models/models.go
index 146f905..419de55 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -109,16 +109,17 @@ type parameter struct {
 }
 
 type round struct {
-	ID         uint       `gorm:"primary_key"`
-	CreatedAt  time.Time  `json:"-"`
-	UpdatedAt  time.Time  `json:"-"`
-	DeletedAt  *time.Time `json:"-"`
-	ElectionID uint
-	parameter  parameter
-	name       string
-	date       time.Time
-	tour       uint
-	deskRounds []deskRound
+	ID             uint       `gorm:"primary_key"`
+	CreatedAt      time.Time  `json:"-"`
+	UpdatedAt      time.Time  `json:"-"`
+	DeletedAt      *time.Time `json:"-"`
+	ElectionID     uint
+	parameter      parameter
+	name           string
+	date           time.Time
+	tour           uint
+	deskRounds     []deskRound
+	candidateLists []candidateList
 }
 
 type deskRound struct {
@@ -130,17 +131,19 @@ type deskRound struct {
 	completed      bool
 	dateCompletion time.Time
 	validated      bool
-	Votes          []Vote
+	votes          []Vote
 }
 type candidateList struct {
 	ID         uint       `gorm:"primary_key"`
 	CreatedAt  time.Time  `json:"-"`
 	UpdatedAt  time.Time  `json:"-"`
 	DeletedAt  *time.Time `json:"-"`
-	PartyID    uint
+	partyID    uint
+	roundID    uint
+	area       area `gorm:"foreignkey:AreaRefer"`
 	name       string
 	candidates []candidate
-	Votes      []Vote
+	votes      []Vote
 }
 
 type candidate struct {
-- 
GitLab