added tests for db and user
Some checks reported errors
arbeitszeitmessung/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
arbeitszeitmessung/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@@ -33,7 +33,7 @@ func submitReport(w http.ResponseWriter, r *http.Request) {
|
||||
userPN, _ := strconv.Atoi(r.FormValue("user"))
|
||||
_weekTs := r.FormValue("week")
|
||||
weekTs, err := time.Parse(time.DateOnly, _weekTs)
|
||||
user, err := (*models.User).GetByPersonalNummer(nil, userPN)
|
||||
user, err := models.GetUserByPersonalNr(userPN)
|
||||
workWeek := (*models.WorkWeek).GetWeek(nil, user, weekTs, false)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -178,7 +178,7 @@ func getBookingsAPI(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
user, err := (*models.User).GetByPersonalNummer(nil, user_pn)
|
||||
user, err := models.GetUserByPersonalNr(user_pn)
|
||||
if err != nil {
|
||||
log.Println("No user found with the given personal number!")
|
||||
http.Error(w, "No user found", http.StatusNotFound)
|
||||
|
||||
@@ -53,7 +53,7 @@ func loginUser(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
user, err := (*models.User).GetByPersonalNummer(nil, personal_nummer)
|
||||
user, err := models.GetUserByPersonalNr(personal_nummer)
|
||||
if err != nil {
|
||||
log.Println("No user found under this personal number!")
|
||||
http.Error(w, "No user found!", http.StatusNotFound)
|
||||
|
||||
@@ -21,7 +21,7 @@ func changePassword(w http.ResponseWriter, r *http.Request) {
|
||||
showUserPage(w, r, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
user, err := (*models.User).GetByPersonalNummer(nil, Session.GetInt(r.Context(), "user"))
|
||||
user, err := models.GetUserByPersonalNr(Session.GetInt(r.Context(), "user"))
|
||||
if err != nil {
|
||||
log.Println("Error getting user!", err)
|
||||
showUserPage(w, r, http.StatusBadRequest)
|
||||
|
||||
Reference in New Issue
Block a user