domain

package
v0.0.0-...-1317d33 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UsernameMinLength is the minimum length of a username.
	UsernameMinLength = 3
	// UsernameMaxLength is the maximum length of a username.
	UsernameMaxLength = 24
	// UserNameMaxLength is the maximum length of a users' name.
	UserNameMaxLength = 64
	// UserBioMaxLength is the maximum length of a users' bio.
	UserBioMaxLength = 256
	// UserMaxAge is the maximum age of a user. funfact: (03/29/2022 - current oldest person is Kane Tananka at age 119)
	UserMaxAge = 120
)

Variables

View Source
var (
	//ErrInvalidUsername is returned when the provided username is invalid (too short or too long).
	ErrInvalidUsername = fiber.NewError(fiber.StatusBadRequest, "invalid-username")
	// ErrInvalidName is returned when the provided name is invalid (too short or too long).
	ErrInvalidName = fiber.NewError(fiber.StatusBadRequest, "invalid-name")
	// ErrUserAlreadyExists is returned when the user already exists.
	ErrUserAlreadyExists = fiber.NewError(fiber.StatusBadRequest, "user-already-exists")
	// ErrUsernameTaken is returned when the username is already taken.
	ErrUsernameTaken = fiber.NewError(fiber.StatusBadRequest, "username-taken")
	// ErrInvalidBio is returned when the provided bio is invalid (too long).
	ErrInvalidBio = fiber.NewError(fiber.StatusBadRequest, "invalid-bio")
	// ErrInvalidAge is returned when the provided age is invalid (too high).
	ErrInvalidAge = fiber.NewError(fiber.StatusBadRequest, "invalid-age")
)

Functions

This section is empty.

Types

type CreateMeetupDTO

type CreateMeetupDTO struct {
	Name           string         `json:"name"`
	Description    string         `json:"description,omitempty"`
	InviteOnly     bool           `json:"invite_only"`
	MinAge         int            `json:"min_age"`
	MeetupLocation MeetupLocation `json:"location,omitempty"`
}

CreateMeetupDTO represents a meetup creation data transfer object.

type CreateUserDTO

type CreateUserDTO struct {
	Username string `json:"username"`
	Name     string `json:"name"`
}

CreateUserDTO is the data transfer object for creating a user.

type Group

type Group struct {
}

type GroupMember

type GroupMember struct{}

type Meetup

type Meetup struct {
	ID             string         `json:"id" gorm:"primaryKey"`
	Name           string         `json:"name"`
	Description    string         `json:"description,omitempty"`
	InviteOnly     bool           `json:"invite_only" gorm:"default:false"`
	MinAge         int            `json:"min_age" gorm:"default:-1"`
	MeetupLocation MeetupLocation `json:"location,omitempty" gorm:"embedded;embeddedPrefix:location_"`
	OwnerID        string         `json:"owner_id"`
	Owner          User           `json:"-" gorm:"foreignKey:OwnerID"`
	Participants   []User         `gorm:"many2many:participants;"`
	CreatedAt      time.Time      `json:"created_at"`
}

Meetup represents a UpMeet meetup.

type MeetupLocation

type MeetupLocation struct {
	Name         string `json:"name,omitempty"`
	Country      string `json:"country,omitempty"`
	State        string `json:"state,omitempty"`
	City         string `json:"city,omitempty"`
	ZipCode      string `json:"zip_code,omitempty"`
	StreetName   string `json:"street_name,omitempty"`
	StreetNumber string `json:"street_number,omitempty"`
}

MeetupLocation represents a meetup location.

type MeetupRepository

type MeetupRepository interface {
	CreateMeetup(m *Meetup) error
	GetMeetupByID(id string) (*Meetup, error)
	UpdateMeetup(m *Meetup) error
	DeleteMeetup(id string) error
}

type MeetupService

type MeetupService interface {
	CreateMeetup(uid string, dto *CreateMeetupDTO) (*Meetup, error)
	GetMeetupByID(uid string, id string) (*Meetup, error)
	UpdateMeetup(uid string, dto *UpdateMeetupDTO) (*Meetup, error)
	DeleteMeetup(uid string, id string) error
}

type ParticipantPermissions

type ParticipantPermissions struct {
	UserID     string    `json:"user_id" gorm:"primaryKey"`
	MeetupID   string    `json:"meetup_id" gorm:"primaryKey"`
	Permission string    `json:"permission" gorm:"primaryKey"`
	CreatedAt  time.Time `json:"created_at"`
}

type UpdateMeetupDTO

type UpdateMeetupDTO struct {
	Name           string         `json:"name"`
	Description    string         `json:"description,omitempty"`
	InviteOnly     bool           `json:"invite_only"`
	MinAge         int            `json:"min_age"`
	MeetupLocation MeetupLocation `json:"location,omitempty"`
}

UpdateMeetupDTO represents a meetup update data transfer object.

type UpdateUserDTO

type UpdateUserDTO struct {
	Username         string    `json:"username,omitempty"`
	Name             string    `json:"name,omitempty"`
	Bio              string    `json:"bio,omitempty"`
	Age              int       `json:"age,omitempty"`
	AgePrivate       bool      `json:"age_private,omitempty"`
	InstagramProfile string    `json:"instagram_profile,omitempty"`
	FacebookProfile  string    `json:"facebook_profile,omitempty"`
	TwitterProfile   string    `json:"twitter_profile,omitempty"`
	DiscordTag       string    `json:"discord_tag,omitempty"`
	Meetups          []*Meetup `gorm:"many2many:participants;"`
}

UpdateUserDTO is the data transfer object for updating a user.

type User

type User struct {
	ID               string    `json:"id" gorm:"primaryKey"`
	Username         string    `json:"username" gorm:"uniqueIndex"`
	Name             string    `json:"name" gorm:"index"`
	ProfilePicture   string    `json:"profile_picture"`
	Age              int       `json:"age" gorm:"default:-1"`
	AgeVerified      bool      `json:"age_verified"`
	AgePrivate       bool      `json:"age_private"`
	Bio              string    `json:"bio"`
	InstagramProfile string    `json:"instagram_profile"`
	FacebookProfile  string    `json:"facebook_profile"`
	TwitterProfile   string    `json:"twitter_profile"`
	DiscordTag       string    `json:"discord_tag"`
	CreatedAt        time.Time `json:"created_at"`
}

User is a user of the UpMeet application.

type UserRepository

type UserRepository interface {
	CreateUser(u *User) error
	GetUserByID(id string) (*User, error)
	GetUserByEmail(email string) (*User, error)
	GetUserByUsername(username string) (*User, error)
	SearchUsersByName(name string) ([]*User, error)
	SearchUsersByUsername(username string) ([]*User, error)
	UpdateUser(u *User) error
	DeleteUser(id string) error
}

type UserService

type UserService interface {
	GetUserByID(uid string) (*User, error)
	CreateUser(uid string, dto *CreateUserDTO) (*User, error)
	UpdateUser(uid string, dto *UpdateUserDTO) (*User, error)
	DeleteUser(uid string) error
}

Directories

Path Synopsis
Package mock_domain is a generated GoMock package.
Package mock_domain is a generated GoMock package.

Jump to

Keyboard shortcuts

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