models

package
v0.0.0-...-d63bc25 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 7 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     uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`
	UserID uuid.UUID `gorm:"type:uuid;index" json:"user_id"`
	Role   string    `gorm:"type:varchar(255)" validate:"oneof='SUPERUSER' 'ADMIN' 'EDITOR'" json:"role"`
	User   User      `gorm:"foreignKey:UserID" json:"user"`
}

type CoverImage

type CoverImage struct {
	ID        uuid.UUID `gorm:"type:uuid;primaryKey;not null" json:"id"`
	FileName  string    `gorm:"type:text" json:"file_name"`
	UserID    uuid.UUID `gorm:"type:uuid;index" json:"user_id"`   // Foreign key to the User table
	Size      int64     `gorm:"not null" json:"size"`             // File size in bytes
	MimeType  string    `gorm:"size:100" json:"mime_type"`        // MIME type of the file
	Extension string    `gorm:"size:100" json:"extension"`        // File extension
	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` // Creation timestamp
	UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` // Update timestamp
	Path      string    `gorm:"size:500;not null" json:"path"`    // File path or location
	IsPublic  bool      `gorm:"default:true" json:"is_public"`    // Public or private flag
}

CoverImage represents the cover image model in the database

type ProfileImage

type ProfileImage struct {
	ID        uuid.UUID `gorm:"type:uuid;primaryKey;not null" json:"id"`
	FileName  string    `gorm:"type:text" json:"file_name"`
	UserID    uuid.UUID `gorm:"type:uuid;index" json:"user_id"`   // Foreign key to the User table
	Size      int64     `gorm:"not null" json:"size"`             // File size in bytes
	MimeType  string    `gorm:"size:100" json:"mime_type"`        // MIME type of the file
	Extension string    `gorm:"size:100" json:"extension"`        // File extension
	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` // Creation timestamp
	UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` // Update timestamp
	Path      string    `gorm:"size:500;not null" json:"path"`    // File path or location
	IsPublic  bool      `gorm:"default:true" json:"is_public"`    // Public or private flag
}

ProfileImage represents the profile image model in the database

type Store

type Store struct {
	EndPoint   string
	AccessId   string
	AccessPass string
	UseSSL     bool
}

func (*Store) Delete

func (m *Store) Delete(bucketName string, path string)

func (*Store) Download

func (m *Store) Download(bucketName string, path string) string

func (*Store) Exist

func (m *Store) Exist(bucketName string, path string) (minio.ObjectInfo, bool)

func (*Store) List

func (m *Store) List(path string)

func (*Store) Stream

func (m *Store) Stream(bucketName string, path string) (*minio.Object, bool)

func (*Store) Upload

func (m *Store) Upload(bucketName string, path string, file string, contentType string) (ErrorFound bool)

type StoreInterface

type StoreInterface interface {
	List(path string)
	Upload(bucketName string, path string, file string, contentType string)
	Delete(bucketName string, path string)
	Download(bucketName string, path string) string
	Stream(bucketName string, path string) string
	Exist(bucketName string, path string)
}

type User

type User struct {
	ID           uuid.UUID     `gorm:"type:uuid;primary_key;" json:"id"`
	FirstName    string        `gorm:"type:varchar(255)" json:"first_name"`
	LastName     string        `gorm:"type:varchar(255)" json:"last_name"`
	Gender       string        `gorm:"type:varchar(255)" json:"gender"`
	BirthDate    time.Time     `json:"birth_date"`
	UserName     string        `gorm:"unique" json:"user_name"`
	UserPassword string        `gorm:"type:varchar(255)" json:"-"`
	MobileNo     string        `json:"mobile_no"`
	EmailID      string        `gorm:"unique" json:"email_id"`
	ProfileImage *ProfileImage `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;foreignKey:UserID" json:"profile_image"` // One-to-many relationship with Files
	CoverImage   *CoverImage   `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;foreignKey:UserID" json:"cover_image"`   // One-to-many relationship with Files
}

User represents the user model in the database

type UserUiModel

type UserUiModel struct {
	FirstName        string    `json:"First_name"`
	LastName         string    `json:"last_name"`
	Gender           string    `json:"gender"`
	BirthDate        time.Time `json:"birth_date"`
	UserName         string    `json:"user_name"`
	UserPassword     string    `json:"user_password"`
	MobileNo         string    `json:"mobile_no"`
	EmailID          string    `json:"email_id"`
	ProfilePicStatus bool      `json:"profile_pic_status"` // this will update whether profile pic will be publicly available or not
	CoverPicStatus   bool      `json:"cover_pic_status"`   // this will update whether cover pic will be publicly available or notPicStatus bool      `json:"profile_pic_status"` // this will update whether profile pic will be publicly available or not
}

Jump to

Keyboard shortcuts

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