admin

package
v0.0.0-...-769062f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	ID             string `json:"_id" bson:"_id"`
	Username       string `json:"username" bson:"username"`
	HashedPassword string `json:"hashedPassword" bson:"hashedPassword"`
	CreatedAt      int64  `json:"createdAt" bson:"createdAt"`
}

type AdminRepository

type AdminRepository struct {
	// contains filtered or unexported fields
}

AdminRepository implements Repository.

func (*AdminRepository) CreateAccount

func (ar *AdminRepository) CreateAccount(username, password string) (string, error)

CreateAccount implements Repository.

func (*AdminRepository) LoginAccount

func (a *AdminRepository) LoginAccount(username, password string) (string, error)

LoginAccount implements Repository.

type Repository

type Repository interface {
	// CreateAccount creates a new admin and returns their id.
	CreateAccount(username, password string) (string, error)
	// LoginAccount authenticate and admin and returns their id.
	LoginAccount(username, password string) (string, error)
}

func NewRepository

func NewRepository(ctx context.Context, db *mongo.Database) (Repository, error)

NewRepository creates a new instance of *AdminRepo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL