chore(auth): finalize test of new structure

This commit is contained in:
2024-09-26 22:43:14 +02:00
committed by Tim Wundenberg
parent 7001a1c2cc
commit 6279a28061
6 changed files with 111 additions and 79 deletions

View File

@@ -90,6 +90,13 @@ func GetUserFromSession(db *sql.DB, r *http.Request) *types.User {
}
func WaitMinimumTime[T interface{}](waitTime time.Duration, function func() (T, error)) (T, error) {
start := time.Now()
result, err := function()
time.Sleep(waitTime - time.Since(start))
return result, err
}
func getSessionID(r *http.Request) string {
for _, c := range r.Cookies() {
if c.Name == "id" {