models

package
v0.0.0-...-1f82a06 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivationToken

type ActivationToken struct {
	Id             uuid.UUID `gorm:"column:id;primary_key"`
	Username       string    `gorm:"column:username"`
	User           User      `gorm:"foreignKey:username"`
	Token          string    `gorm:"column:token;not_null;varchar(6)"`
	ExpirationTime time.Time `gorm:"column:expiration_time;not_null"`
}

type ActivationTokenRequestDTO

type ActivationTokenRequestDTO struct {
	Token string `json:"token" binding:"required"`
}

type AuthorDTO

type AuthorDTO struct {
	Username          string `json:"username"`
	Nickname          string `json:"nickname"`
	ProfilePictureUrl string `json:"profilePictureUrl"`
}

type ChangePasswordDTO

type ChangePasswordDTO struct {
	OldPassword string `json:"oldPassword" binding:"required"`
	NewPassword string `json:"newPassword" binding:"required"`
}

type GeneralFeedDTO

type GeneralFeedDTO struct {
	Records    []PostResponseDTO         `json:"records"`
	Pagination *GeneralFeedPaginationDTO `json:"pagination"`
}

type GeneralFeedPaginationDTO

type GeneralFeedPaginationDTO struct {
	LastPostId string `json:"lastPostId"`
	Limit      int    `json:"limit"`
	Records    int64  `json:"records"`
}

type Hashtag

type Hashtag struct {
	Id    uuid.UUID `gorm:"primary_key"`
	Name  string    `gorm:"uniqueIndex"`
	Posts []Post    `gorm:"many2many:post_hashtags;"` // gorm handles the join table
}

type Location

type Location struct {
	Id        uuid.UUID `gorm:"column:id;primary_key"`
	Longitude float64   `gorm:"type:float"`
	Latitude  float64   `gorm:"type:float"`
	Accuracy  uint      `gorm:"type:integer"`
}

type LocationDTO

type LocationDTO struct {
	Longitude *float64 `json:"longitude" binding:"required"` // using pointer to allow values to be zero
	Latitude  *float64 `json:"latitude" binding:"required"`
	Accuracy  *uint    `json:"accuracy" binding:"required"`
}

type Post

type Post struct {
	Id         uuid.UUID  `gorm:"column:id;primary_key"`
	Username   string     `gorm:"column:username"`
	User       User       `gorm:"foreignKey:username;references:username"`
	Content    string     `gorm:"column:content;type:varchar(256);null"`
	ImageUrl   string     `gorm:"column:image_url;type:varchar(128);null"`
	Hashtags   []Hashtag  `gorm:"many2many:post_hashtags;onDelete:CASCADE"` // gorm handles the join table, onDelete:CASCADE deletes the hashtags if the post is deleted
	CreatedAt  time.Time  `gorm:"column:created_at;not_null"`
	LocationId *uuid.UUID `gorm:"column:location_id;null"`
	Location   Location   `gorm:"foreignKey:location_id;references:id"`
}

type PostCreateRequestDTO

type PostCreateRequestDTO struct {
	Content  string       `json:"content" binding:"required"`
	Location *LocationDTO `json:"location" `
}

type PostResponseDTO

type PostResponseDTO struct {
	PostId       uuid.UUID    `json:"postId"`
	Author       *AuthorDTO   `json:"author"`
	CreationDate time.Time    `json:"creationDate"`
	Content      string       `json:"content"`
	Location     *LocationDTO `json:"location"`
}

type Subscription

type Subscription struct {
	Id                uuid.UUID `gorm:"column:id;primary_key"`
	SubscriptionDate  time.Time `gorm:"column:subscription_date;not null"`
	FollowerUsername  string    `gorm:"column:follower;type:varchar(20)"`
	Follower          User      `gorm:"foreignKey:username;references:follower"` // Person who follows
	FollowingUsername string    `gorm:"column:following;type:varchar(20)"`       // Person who is being followed
	Following         User      `gorm:"foreignKey:username;references:following"`
}

type SubscriptionPaginationDTO

type SubscriptionPaginationDTO struct {
	Offset  int   `json:"offset"`
	Limit   int   `json:"limit"`
	Records int64 `json:"records"`
}

type SubscriptionPostRequestDTO

type SubscriptionPostRequestDTO struct {
	Following string `json:"following" binding:"required"`
}

type SubscriptionPostResponseDTO

type SubscriptionPostResponseDTO struct {
	SubscriptionId   uuid.UUID `json:"subscriptionId"`
	SubscriptionDate time.Time `json:"subscriptionDate"`
	Follower         string    `json:"username"`
	Following        string    `json:"following"`
}

type SubscriptionResponseDTO

type SubscriptionResponseDTO struct {
	Records    []UserSubscriptionRecordDTO `json:"records"`
	Pagination *SubscriptionPaginationDTO  `json:"pagination"`
}

type User

type User struct {
	Username          string    `gorm:"primary_key;type:varchar(20);not_null;unique"`
	Nickname          string    `gorm:"type:varchar(25)"`
	Email             string    `gorm:"type:varchar(128);not_null;unique"`
	PasswordHash      string    `gorm:"type:varchar(80);not_null"`
	CreatedAt         time.Time `gorm:"column:created_at;not_null"`
	Activated         bool      `gorm:"not_null"`
	ProfilePictureUrl string    `gorm:"type:varchar(128);null"`
	Status            string    `gorm:"type:varchar(128)"`
}

type UserActivationRequestDTO

type UserActivationRequestDTO struct {
	Token string `json:"token" binding:"required"`
}

type UserCreateRequestDTO

type UserCreateRequestDTO struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
	Nickname string `json:"nickname"`
	Email    string `json:"email" binding:"required"`
}

type UserFeedDTO

type UserFeedDTO struct {
	Records    []UserFeedRecordDTO    `json:"records"`
	Pagination *UserFeedPaginationDTO `json:"pagination"`
}

type UserFeedPaginationDTO

type UserFeedPaginationDTO struct {
	Offset  int   `json:"offset"`
	Limit   int   `json:"limit"`
	Records int64 `json:"records"`
}

type UserFeedRecordDTO

type UserFeedRecordDTO struct {
	PostId       string       `json:"postId"`
	CreationDate time.Time    `json:"creationDate"`
	Content      string       `json:"content"`
	Location     *LocationDTO `json:"location"`
}

type UserInformationUpdateDTO

type UserInformationUpdateDTO struct {
	Nickname string `json:"nickname"`
	Status   string `json:"status"`
}

type UserLoginRequestDTO

type UserLoginRequestDTO struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type UserLoginResponseDTO

type UserLoginResponseDTO struct {
	Token        string `json:"token"`
	RefreshToken string `json:"refreshToken"`
}

type UserProfileResponseDTO

type UserProfileResponseDTO struct {
	Username          string  `json:"username"`
	Nickname          string  `json:"nickname"`
	Status            string  `json:"status"`
	ProfilePictureUrl string  `json:"profilePictureUrl"`
	Follower          int64   `json:"follower"`
	Following         int64   `json:"following"`
	Posts             int64   `json:"posts"`
	SubscriptionId    *string `json:"subscriptionId"`
}

type UserRefreshTokenRequestDTO

type UserRefreshTokenRequestDTO struct {
	RefreshToken string `json:"refreshToken" binding:"required"`
}

type UserResponseDTO

type UserResponseDTO struct {
	Username string `json:"username"`
	Nickname string `json:"nickname"`
	Email    string `json:"email"`
}

type UserSearchPaginationDTO

type UserSearchPaginationDTO struct {
	Offset  int   `json:"offset"`
	Limit   int   `json:"limit"`
	Records int64 `json:"records"`
}

type UserSearchRecordDTO

type UserSearchRecordDTO struct {
	Username          string `json:"username"`
	Nickname          string `json:"nickname"`
	ProfilePictureUrl string `json:"profilePictureUrl"`
}

type UserSearchResponseDTO

type UserSearchResponseDTO struct {
	Records    []UserSearchRecordDTO    `json:"records"`
	Pagination *UserSearchPaginationDTO `json:"pagination"`
}

type UserSubscriptionRecordDTO

type UserSubscriptionRecordDTO struct {
	FollowerId        *uuid.UUID `gorm:"column:follower_id" json:"followerId"`                // SubscriptionID, wenn Nutzer mir folgt - ggf. null
	FollowingId       *uuid.UUID `gorm:"column:following_id" json:"followingId"`              // SubscriptionID, wenn ich Nutzer folge - ggf. null
	Username          string     `gorm:"column:username" json:"username"`                     // Der Benutzername des Followers/Following
	Nickname          string     `gorm:"column:nickname" json:"nickname"`                     // Der Spitzname des Followers/Following
	ProfilePictureUrl string     `gorm:"column:profile_picture_url" json:"profilePictureUrl"` // Die URL des Profilbildes des Followers/Following
}

type UserSubscriptionSearchRecordDTO

type UserSubscriptionSearchRecordDTO struct {
	Username          string `json:"username"`
	Nickname          string `json:"nickname"`
	ProfilePictureUrl string `json:"profilePictureUrl"`
}

Jump to

Keyboard shortcuts

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