aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/auth.go
blob: f27b8c0bb561a496a66720b2a67f03254b33d0db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main

import (
	"context"
	"fmt"

	"iosdc-code-battle-poc/db"
)

func authLogin(ctx context.Context, queries *db.Queries, username, password string) (int, error) {
	userAuth, err := queries.GetUserAuthFromUsername(ctx, username)
	if err != nil {
		return 0, err
	}
	if userAuth.AuthType == "bypass" {
		return int(userAuth.UserID), nil
	}
	return 0, fmt.Errorf("not implemented")
}