models

package
v0.0.0-...-73b1491 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const COOKIE_NAME = "jwt"
View Source
const PostRecordType = "post"
View Source
const UserRecordType = "user"

Variables

This section is empty.

Functions

func GenerateCookie

func GenerateCookie(cookieSecret *securecookie.SecureCookie, name string, value string, expDuration time.Duration, secure bool) *http.Cookie

func GenerateExpiredCookie

func GenerateExpiredCookie(name string) *http.Cookie

func GenerateToken

func GenerateToken(secretKey []byte, userID string, expDuration time.Duration) (string, error)

func GetKeysFromEmail

func GetKeysFromEmail(email string) (string, string)

func NewHashedUUID

func NewHashedUUID(hashItem string) string

func NewPostRecordPK

func NewPostRecordPK(userID string) string

func NewPostRecordSK

func NewPostRecordSK(postID string) string

func NewUUID

func NewUUID() string

func NewUserRecordKey

func NewUserRecordKey(id string) string

func ParseCookie

func ParseCookie(r *http.Request, cookieSecret *securecookie.SecureCookie, name string) (string, error)

Types

type Claims

type Claims struct {
	UserID string `json:"user_id"`
	jwt.StandardClaims
}

type DeleteFilesDto

type DeleteFilesDto struct {
	UserID string
	Files  map[string]string
}

type LoginDto

type LoginDto struct {
	Email    string
	Password string
}

type Post

type Post struct {
	ID          string            `dynamodbav:"ID"          json:"id"`
	Name        string            `dynamodbav:"Name"        json:"name"`
	Description string            `dynamodbav:"Description" json:"description"`
	Files       map[string]string `dynamodbav:"Files"       json:"files"`
	UserID      string            `dynamodbav:"UserID"      json:"userID"`
	CreatedAt   time.Time         `dynamodbav:"CreatedAt"   json:"createdAt"`
}

func NewPost

func NewPost(postData PostDto, userID string) Post

func NewPostFromRecord

func NewPostFromRecord(pr PostRecord) Post

type PostDto

type PostDto struct {
	Name        string
	Description string
	Files       map[string]string
}

type PostRecord

type PostRecord struct {
	Record
	Post
}

func NewPostRecord

func NewPostRecord(post Post) PostRecord

type Record

type Record struct {
	PK   string `dynamodbav:"PK"  json:"pk"`
	SK   string `dynamodbav:"SK"  json:"sk"`
	Type string `dynamodbav:"Typ" json:"typ"`
}

type RegisterDto

type RegisterDto struct {
	Email    string
	Password string
	Confirm  string
}

type User

type User struct {
	ID        string    `dynamodbav:"ID"        json:"id"`
	Email     string    `dynamodbav:"Email"     json:"email"`
	Password  string    `dynamodbav:"Password"  json:"-"`
	CreatedAt time.Time `dynamodbav:"CreatedAt" json:"createdAt"`
}

func NewUser

func NewUser(userData RegisterDto) User

func NewUserFromRecord

func NewUserFromRecord(ur UserRecord) User

type UserRecord

type UserRecord struct {
	Record
	User
}

func NewUserRecord

func NewUserRecord(user User) UserRecord

Jump to

Keyboard shortcuts

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