Protected POST /account and fixed with JWT stuff in general

This commit is contained in:
2021-01-03 18:21:42 +01:00
parent bb7e525adc
commit a36ec47324
13 changed files with 352 additions and 40 deletions

View File

@@ -1,15 +1,26 @@
package db
import (
"time"
"github.com/google/uuid"
"github.com/jackc/pgx/v4/pgxpool"
)
// Account is an account as represented in the database
type Account struct {
ID uuid.UUID `json:"id"`
Created time.Time `json:"created"`
Fields map[string][]string `json:"fields"`
Name string `json:"name"`
Password string `json:"-"`
}
// CreatedAccount is a newly created account in the system
type CreatedAccount struct {
ID uuid.UUID `json:"id"`
AccountName string `json:"accountName"`
APIKey string `json:"apiKey"`
ID uuid.UUID `json:"id"`
Name string `json:"name"`
APIKey string `json:"apiKey"`
}
// AccountCreateInputFields yes
@@ -20,11 +31,11 @@ type AccountCreateInputFields struct {
// AccountCreateInput is used as input struct for database creation of account
type AccountCreateInput struct {
ID uuid.UUID
AccountName string
APIKey string
Fields []AccountCreateInputFields
Password string
ID uuid.UUID
Name string
APIKey string
Fields []AccountCreateInputFields
Password string
}
// Db struct