Commit 68aa3753 authored by Julien Schröter's avatar Julien Schröter Committed by Frederik Wegner

Resolve "Select university on registration"

parent 97b49cf1
Pipeline #2267 passed with stage
in 4 minutes and 27 seconds
......@@ -896,7 +896,20 @@ paths:
description: Authentication failure.
'500':
description: The server was unable to perform the requested operation.
'/university':
get:
security: []
summary: Get all registered universities.
description: Get a list of universities, which Akamu is available to.
responses:
'200':
description: List of universities.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/university'
'/avatar':
get:
summary: Get all unlocked avatars.
......@@ -1138,7 +1151,6 @@ components:
- username
- password
- email
- university
- semester
properties:
username:
......@@ -1148,8 +1160,6 @@ components:
email:
type: string
format: email
university:
type: string
semester:
type: integer
format: int32
......@@ -1191,7 +1201,7 @@ components:
verified:
type: boolean
university:
type: string
$ref: '#/components/schemas/university'
experience:
type: integer
format: int32
......@@ -1200,6 +1210,22 @@ components:
format: int32
email:
type: string
university:
description: University with its details.
type: object
properties:
id:
type: integer
format: uint32
name:
type: string
shortform:
type: string
city:
type: string
domain:
description: Domain for university emails. Email addresses must match either *@<domain> or *@*.<domain>
type: string
patch-user:
description: Updated values for the currently logged in user.
type: object
......
package university
import (
"net/http"
"github.com/getsentry/raven-go"
"github.com/gin-gonic/gin"
)
func GetUniversities(repository UniversityQuery) gin.HandlerFunc {
return func(ctx *gin.Context) {
universities, err := repository.SelectAll()
if err != nil {
raven.CaptureError(err, nil)
ctx.AbortWithError(http.StatusInternalServerError, err)
return
}
ctx.JSON(http.StatusOK, universities)
}
}
package university
import (
"database/sql"
"fmt"
"gitlab.akamu.de/akamu/game-server-go/dbhandler"
"gitlab.akamu.de/akamu/game-server-go/schemas"
)
type UniversityQuery interface {
SelectAll() ([]schemas.UniversitySchema, error)
SelectByEmail(email string) (*schemas.UniversitySchema, error)
}
type MySQLUniversityQuery struct{}
func (*MySQLUniversityQuery) SelectAll() ([]schemas.UniversitySchema, error) {
db, err := dbhandler.GetDBConnection()
if err != nil {
return nil, fmt.Errorf("failed to receive database connection: %v", err)
}
rows, err := db.Query("SELECT `iduniversity`, `name`, `shortform`, `city`, `domain` FROM `university`")
if err != nil {
return nil, fmt.Errorf("failed to query universities: %v", err)
}
result := make([]schemas.UniversitySchema, 0)
for rows.Next() {
var u schemas.UniversitySchema
if err := rows.Scan(&u.ID, &u.Name, &u.Shortform, &u.City, &u.Domain); err != nil {
return nil, fmt.Errorf("error while fetching universities from database: %v", err)
}
result = append(result, u)
}
return result, nil
}
func (*MySQLUniversityQuery) SelectByEmail(email string) (*schemas.UniversitySchema, error) {
db, err := dbhandler.GetDBConnection()
if err != nil {
return nil, fmt.Errorf("failed to receive database connection: %v", err)
}
row := db.QueryRow("SELECT `iduniversity`, `name`, `shortform`, `city`, `domain` FROM `university` WHERE ? RLIKE CONCAT('^.+[\\.@]', `domain`, '$')", email)
var u schemas.UniversitySchema
if err := row.Scan(&u.ID, &u.Name, &u.Shortform, &u.City, &u.Domain); err != nil {
if err == sql.ErrNoRows {
return nil, nil
}
return nil, fmt.Errorf("failed to validate email address against universities: %v", err)
}
return &u, nil
}
......@@ -10,6 +10,7 @@ import (
"gitlab.akamu.de/akamu/game-server-go/endpoint"
"gitlab.akamu.de/akamu/game-server-go/endpoint/title"
"gitlab.akamu.de/akamu/game-server-go/endpoint/university"
"gitlab.akamu.de/akamu/game-server-go/sendmail"
"gitlab.akamu.de/akamu/game-server-go/token/otp"
......@@ -53,7 +54,7 @@ func SetupUserRoutes(group *gin.RouterGroup, repository UserQuery, titleReposito
* In case the request is executed successfully the response value is
* a json containing the user database id and authentication token.
*/
func RegisterUser(repository UserQuery, tokenFactory otp.TokenFactory, verifyEmail *sendmail.TemplateMail) gin.HandlerFunc {
func RegisterUser(repository UserQuery, universityRepository university.UniversityQuery, tokenFactory otp.TokenFactory, verifyEmail *sendmail.TemplateMail) gin.HandlerFunc {
return func(ctx *gin.Context) {
//database type is int(11)
......@@ -83,8 +84,18 @@ func RegisterUser(repository UserQuery, tokenFactory otp.TokenFactory, verifyEma
return
}
if err := validateEmailDomain(signUpForm.Email); err != nil {
ctx.String(http.StatusBadRequest, fmt.Sprintf("domain of email address violates rules: %v", err))
// fetch university
university, err := universityRepository.SelectByEmail(signUpForm.Email)
if err != nil {
raven.CaptureError(err, nil)
ctx.AbortWithError(http.StatusInternalServerError, err)
return
}
// temporary: allow users not attending an university later
if university == nil && endpoint.IsProduction() {
ctx.AbortWithStatus(http.StatusBadRequest)
return
}
//creates an empty user struct
......@@ -96,7 +107,7 @@ func RegisterUser(repository UserQuery, tokenFactory otp.TokenFactory, verifyEma
Experience: initialUserExperience,
SelectedAvatar: initialUserAvatar,
SelectedTitle: initialUserTitle,
University: signUpForm.University,
University: university,
Verified: initialVerifiedStatus}
//insert user into the Akamu sql database and returns the id
......
......@@ -99,9 +99,14 @@ func (MySQLUserQuery) Insert(user *schemas.FullUserSchema, password string) (id
return 0, fmt.Errorf("failed to hash the password with bcrypt: " + err.Error())
}
university := sql.NullInt32{}
if user.University != nil {
university = sql.NullInt32{Valid: true, Int32: user.University.ID}
}
//execute sql statement to insert the new user into the user table
_, err = stmt.Exec(user.TimeRegistered, user.Username, hashed,
user.Email, user.Semester, user.Experience, user.Verified, user.University)
user.Email, user.Semester, user.Experience, user.Verified, university)
//check for erros while executing the insert sql statement
if err != nil {
......@@ -168,7 +173,7 @@ func (MySQLUserQuery) Select(id uint32) ([]schemas.FullUserSchema, error) {
}
//create statement to fetch user from db
stmt, err := db.Prepare("select iduser, time_registered, username, email, semester, experience, idavatar, avatar.image, avatar.level, title.idtitle, title.name, subject.idsubject, subject.name, subject.shortform, subject.department, subject.description, title.unlock_score, title.unlock_win, verified, user.university, user.level FROM user LEFT JOIN title ON (title.idtitle=selected_title) LEFT JOIN subject ON (idsubject=title.subject) LEFT JOIN avatar ON (idavatar=selected_avatar) WHERE iduser = ?")
stmt, err := db.Prepare("select iduser, time_registered, username, email, semester, experience, idavatar, avatar.image, avatar.level, title.idtitle, title.name, subject.idsubject, subject.name, subject.shortform, subject.department, subject.description, title.unlock_score, title.unlock_win, verified, iduniversity, university.name, university.shortform, university.city, university.domain, user.level FROM user LEFT JOIN title ON (title.idtitle=selected_title) LEFT JOIN subject ON (idsubject=title.subject) LEFT JOIN avatar ON (idavatar=selected_avatar) LEFT JOIN university ON (iduniversity=user.university) WHERE iduser = ?")
if err != nil {
return nil, fmt.Errorf("Could not prepare sql statement to retrieve user from Datase. " + err.Error())
}
......@@ -184,6 +189,13 @@ func (MySQLUserQuery) Select(id uint32) ([]schemas.FullUserSchema, error) {
var tmpSubjectDepartment sql.NullString
var tmpSubjectDescription sql.NullString
// Temporary university
var tmpUniversityID sql.NullInt32
var tmpUniversityName sql.NullString
var tmpUniversityShortform sql.NullString
var tmpUniversityCity sql.NullString
var tmpUniversityDomain sql.NullString
var tmpUnlockScore sql.NullInt32
var tmpUnlockWin sql.NullInt32
......@@ -208,7 +220,11 @@ func (MySQLUserQuery) Select(id uint32) ([]schemas.FullUserSchema, error) {
&tmpUnlockScore,
&tmpUnlockWin,
&users[0].Verified,
&users[0].University,
&tmpUniversityID,
&tmpUniversityName,
&tmpUniversityShortform,
&tmpUniversityCity,
&tmpUniversityDomain,
&users[0].Level)
if err != nil {
if err == sql.ErrNoRows {
......@@ -228,6 +244,16 @@ func (MySQLUserQuery) Select(id uint32) ([]schemas.FullUserSchema, error) {
}
}
if tmpUniversityID.Valid {
users[0].University = &schemas.UniversitySchema{
ID: tmpUniversityID.Int32,
Name: tmpUniversityName.String,
Shortform: tmpUniversityShortform.String,
City: tmpUniversityCity.String,
Domain: tmpUniversityDomain.String,
}
}
if tmpUnlockScore.Valid {
users[0].SelectedTitle.UnlockScore = tmpUnlockScore.Int32
} else {
......
......@@ -4,7 +4,6 @@ type SignUpRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
Email string `json:"email" binding:"required,email"`
University string `json:"university" binding:"required"`
Semester uint32 `json:"semester" binding:"required"`
}
......
package user
import (
"fmt"
"strings"
"gitlab.akamu.de/akamu/game-server-go/version"
)
// password rules
......@@ -23,18 +20,3 @@ func CheckPasswordOK(pw string) bool {
return containsLower && containsUpper
}
func validateEmailDomain(email string) error {
// This is only for master builds
if version.Environment != "master" {
return nil
}
// Check email suffix against passlist
for i := 0; i < len(emailPasslist); i += 1 {
if strings.HasSuffix(email, emailPasslist[i]) {
return nil
}
}
return fmt.Errorf("email address needs to end with %v", emailPasslist)
}
......@@ -2,6 +2,7 @@ package endpoint
import (
"errors"
"flag"
"net/http"
"github.com/getsentry/raven-go"
......@@ -11,6 +12,7 @@ import (
"github.com/gin-gonic/gin"
"gitlab.akamu.de/akamu/game-server-go/schemas"
"gitlab.akamu.de/akamu/game-server-go/version"
)
var ErrFetchingSessionPayload = errors.New("failed to fetch session payload")
......@@ -71,3 +73,9 @@ func GetTranslator() ut.Translator {
return translator
}
// IsProduction returns true when the server was built
// from the master branch or is running tests.
func IsProduction() bool {
return (version.Environment == "master" || flag.Lookup("test.v") != nil)
}
......@@ -11,6 +11,7 @@ import (
"time"
"gitlab.akamu.de/akamu/game-server-go/endpoint/resource"
"gitlab.akamu.de/akamu/game-server-go/endpoint/university"
"gitlab.akamu.de/akamu/game-server-go/endpoint/refreshjwt"
......@@ -208,7 +209,7 @@ func main() {
panic("Setting could not be loaded." + errLoadSettings.Error())
}
router := setup.SetupRoutes(&course.MySQLTitleQuery{}, &flashcard.MySQLFlashcardQuery{}, &subject.MySQLSubjectQuery{}, &title.MySQLTitleQuery{}, &traininglist.MySQLTrainingListQuery{}, &user.MySQLUserQuery{}, &pool.MySQLPoolQuery{}, &friend.MySQLFriendQuery{}, &avatar.MySQLAvatarQuery{}, &duel.MySQLDuelQuery{}, &refreshjwt.MySQLRefreshJWTQuery{}, &resource.MySQLResourceQuery{}, &cfg.ResourceServer, settings, &cfg.SMTP, cfg.JwtSecret)
router := setup.SetupRoutes(&course.MySQLTitleQuery{}, &flashcard.MySQLFlashcardQuery{}, &subject.MySQLSubjectQuery{}, &title.MySQLTitleQuery{}, &traininglist.MySQLTrainingListQuery{}, &user.MySQLUserQuery{}, &pool.MySQLPoolQuery{}, &friend.MySQLFriendQuery{}, &avatar.MySQLAvatarQuery{}, &duel.MySQLDuelQuery{}, &refreshjwt.MySQLRefreshJWTQuery{}, &resource.MySQLResourceQuery{}, &university.MySQLUniversityQuery{}, &cfg.ResourceServer, settings, &cfg.SMTP, cfg.JwtSecret)
raven.CapturePanic(func() {
// By default it serves on :8080 unless a
......
......@@ -92,8 +92,8 @@ INSERT INTO title (idtitle, name, subject, unlock_score, unlock_win) VALUES (2,"
INSERT INTO title (idtitle, name, subject, unlock_score, unlock_win) VALUES (3,"easy",1,5,0); -- answering one question correctly will unlock this title
-- UNIVERSITY
INSERT INTO university (iduniversity, name, shortform, city, country) VALUES (1,"Technische Universität Darmstadt","TU Darmstadt","Darmstadt","Deutschland");
INSERT INTO university (iduniversity, name, shortform, city, country) VALUES (2,"Hochschule Darmstadt","HDA","Darmstadt","Deutschland");
INSERT INTO university (iduniversity, name, shortform, city, country, domain) VALUES (1,"Technische Universität Darmstadt","TU Darmstadt","Darmstadt","Deutschland", "tu-darmstadt.de");
INSERT INTO university (iduniversity, name, shortform, city, country, domain) VALUES (2,"Hochschule Darmstadt","HDA","Darmstadt","Deutschland", "h-da.de");
-- SUBJECT
INSERT INTO subject (idsubject, name, shortform, department, university, description, idmongo)
......
package schemas
type UniversitySchema struct {
ID int32 `json:"id"`
Name string `json:"name"`
Shortform string `json:"shortform"`
City string `json:"city"`
Domain string `json:"domain"`
}
......@@ -19,7 +19,7 @@ type FullUserSchema struct {
Semester uint32 `json:"semester,omitempty"`
Experience int `json:"experience"`
Level int `json:"level"`
University string `json:"university,omitempty"`
University *UniversitySchema `json:"university"`
Verified bool `json:"verified,omitempty"`
}
......
......@@ -36,6 +36,7 @@ import (
"gitlab.akamu.de/akamu/game-server-go/endpoint/subject"
"gitlab.akamu.de/akamu/game-server-go/endpoint/title"
"gitlab.akamu.de/akamu/game-server-go/endpoint/traininglist"
"gitlab.akamu.de/akamu/game-server-go/endpoint/university"
"gitlab.akamu.de/akamu/game-server-go/endpoint/user"
"gitlab.akamu.de/akamu/game-server-go/endpoint/usernameavailable"
"gitlab.akamu.de/akamu/game-server-go/setting"
......@@ -121,7 +122,7 @@ func getRoot(ctx *gin.Context) {
ctx.String(http.StatusOK, "AKAMU REST API")
}
func SetupRoutes(courseRepository course.CourseQuery, flashcardRepository flashcard.FlashcardQuery, subjectRepository subject.SubjectQuery, titleRepository title.TitleQuery, traininglistRepository traininglist.TrainingListQuery, userRepository user.UserQuery, poolRepository pool.PoolQuery, friendRepository friend.FriendQuery, avatarRepository avatar.AvatarQuery, duelRepository duel.DuelQuery, refreshjwtRepository refreshjwt.RefreshJWTQuery, resourceRepository resource.ResourceQuery, resourceServerConfig *config.ResourceServer, settings *setting.Settings, smtpTransport *sendmail.Transport, jwtSecret ...string) *gin.Engine {
func SetupRoutes(courseRepository course.CourseQuery, flashcardRepository flashcard.FlashcardQuery, subjectRepository subject.SubjectQuery, titleRepository title.TitleQuery, traininglistRepository traininglist.TrainingListQuery, userRepository user.UserQuery, poolRepository pool.PoolQuery, friendRepository friend.FriendQuery, avatarRepository avatar.AvatarQuery, duelRepository duel.DuelQuery, refreshjwtRepository refreshjwt.RefreshJWTQuery, resourceRepository resource.ResourceQuery, universityRepository university.UniversityQuery, resourceServerConfig *config.ResourceServer, settings *setting.Settings, smtpTransport *sendmail.Transport, jwtSecret ...string) *gin.Engine {
//gin.SetMode(gin.ReleaseMode)
router := gin.Default()
......@@ -265,7 +266,7 @@ func SetupRoutes(courseRepository course.CourseQuery, flashcardRepository flashc
authGroup.Use(authMiddleware.MiddlewareFunc())
router.POST("/login", authMiddleware.LoginHandler)
router.POST("/register", user.RegisterUser(userRepository, tokenFactory, userVerifyMail))
router.POST("/register", user.RegisterUser(userRepository, universityRepository, tokenFactory, userVerifyMail))
router.GET("/verify", user.Verify(userRepository, tokenFactory, userVerifyMail))
......@@ -303,6 +304,12 @@ func SetupRoutes(courseRepository course.CourseQuery, flashcardRepository flashc
ctx.JSON(http.StatusOK, version.Version)
})
router.GET("/university", university.GetUniversities(universityRepository))
router.OPTIONS("/university", func(ctx *gin.Context) {
ctx.Header("Allow", "GET")
ctx.Status(200)
})
usernameavailable.SetupUsernameavailableRoutes(router.Group("/usernameavailable"), userRepository)
user.SetupUserRoutes(authGroup.Group("/user"), userRepository, titleRepository)
flashcard.SetupFlashcardRoutes(authGroup.Group("/flashcard"), flashcardRepository)
......
......@@ -15,7 +15,7 @@ import (
func Test_isAvailable_200_true(t *testing.T) {
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, nil, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, nil, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -38,7 +38,7 @@ func Test_isAvailable_200_true(t *testing.T) {
func Test_isAvailable_200_false(t *testing.T) {
router := setup.SetupRoutes(nil, nil, nil, &mockTitle{}, nil, &mockUser{}, nil, nil, nil, nil, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, &mockTitle{}, nil, &mockUser{}, nil, nil, nil, nil, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......
......@@ -29,7 +29,7 @@ func (mockAvatar) SelectAll() ([]schemas.AvatarSchema, error) {
type mockAvatarError struct{}
func Test_getAvatars200(t *testing.T) {
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -45,7 +45,7 @@ func Test_getAvatars200(t *testing.T) {
}
func Test_getAvatars401(t *testing.T) {
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -58,7 +58,7 @@ func Test_getAvatars401(t *testing.T) {
}
func Test_getAllAvatars200(t *testing.T) {
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -74,7 +74,7 @@ func Test_getAllAvatars200(t *testing.T) {
}
func Test_getAllAvatars401(t *testing.T) {
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, &mockAvatar{}, nil, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......
......@@ -307,7 +307,7 @@ func newMockDuel() mockDuel {
func Test_getAllDuels200(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
// Test with user1
env1 := new(TestEnv)
......@@ -342,7 +342,7 @@ func Test_getAllDuels200(t *testing.T) {
func Test_getDuel200(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -361,7 +361,7 @@ func Test_getDuel200(t *testing.T) {
func Test_getDuel401(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -376,7 +376,7 @@ func Test_getDuel401(t *testing.T) {
func Test_getDuel403(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -392,7 +392,7 @@ func Test_getDuel403(t *testing.T) {
func Test_getDuel404(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -407,7 +407,7 @@ func Test_getDuel404(t *testing.T) {
func Test_postDuel201(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -429,7 +429,7 @@ func Test_postDuel201(t *testing.T) {
func Test_postDuel400(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
backup, _ := json.Marshal(duelRepo.duels)
......@@ -459,7 +459,7 @@ func Test_postDuel400(t *testing.T) {
func Test_postDuel401(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -473,7 +473,7 @@ func Test_postDuel401(t *testing.T) {
func Test_postDuel403(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -488,7 +488,7 @@ func Test_postDuel403(t *testing.T) {
func Test_postDuel404(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -503,7 +503,7 @@ func Test_postDuel404(t *testing.T) {
func Test_getDuelPool200(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -521,7 +521,7 @@ func Test_getDuelPool200(t *testing.T) {
func Test_getDuelPool400(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -536,7 +536,7 @@ func Test_getDuelPool400(t *testing.T) {
func Test_getDuelPool401(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......@@ -550,7 +550,7 @@ func Test_getDuelPool401(t *testing.T) {
func Test_getDuelPool403(t *testing.T) {
duelRepo := newMockDuel()
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil)
router := setup.SetupRoutes(nil, nil, nil, nil, nil, &mockUser{}, nil, nil, nil, &duelRepo, newSession(), nil, nil, nil, nil, nil)
env := new(TestEnv)
env.Router = router
......