dtos

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractObjectKeyFromRequest

func ExtractObjectKeyFromRequest(dto any) (string, error)

Types

type AcceptFriendRequest

type AcceptFriendRequest struct {
	WithRequestID
}

type AvatarResetResponse

type AvatarResetResponse struct {
	Message string `json:"message" example:"Avatar successfully reset"`
	Avatar  string `json:"avatar" example:"https://s3.amazonaws.com/bucket/avatars/123.png"`
}

type ChangePasswordRequest

type ChangePasswordRequest struct {
	NewPassword string `json:"new_password" binding:"required,min=6"`
}

type CreateCommentRequest

type CreateCommentRequest struct {
	Content   string  `json:"content" binding:"required,max=3000"`
	TrackID   string  `json:"track_id" binding:"required,uuid"`
	AuthorID  string  `json:"author_id" binding:"required,uuid"`
	ReplyToID *string `json:"reply_to_id" binding:"omitempty,uuid"` // Optional pointer
}

1. INPUT (Create)

type CreateProjectRequest

type CreateProjectRequest struct {
	Name        string `json:"name" binding:"required,min=1,max=100"`
	Description string `json:"description" binding:"omitempty,max=500"`
}

1. INPUT (Create Project)

type CreateTrackRequest

type CreateTrackRequest struct {
	HasObjectKey
	Name      string `json:"name" binding:"required,min=1,max=100"`
	GenreID   string `json:"genre_id" binding:"required,uuid"`
	IsPublic  bool   `json:"is_public"`
	ObjectKey string `json:"object_key" binding:"required"`
}

CreateTrackRequest is used for validating input when uploading a new track.

func (CreateTrackRequest) GetObjectKey

func (req CreateTrackRequest) GetObjectKey() string

type GenreSummary

type GenreSummary struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

GenreSummary is used when embedding a genre inside a Track response

type GetPrivateTrackUploadUrl

type GetPrivateTrackUploadUrl struct {
	AudioFile string `json:"audio_file" binding:"omitempty"`
}

type HasObjectKey

type HasObjectKey interface {
	GetObjectKey() string
}

type IDMessageResponse

type IDMessageResponse struct {
	ID      string `json:"id" example:"123e4567-e89b-12d3-a456-426614174000"`
	Message string `json:"message" example:"Resource successfully created"`
}

type LoginRequest

type LoginRequest struct {
	Identifier string `json:"identifier" binding:"required"`
	Password   string `json:"password" binding:"required"`
}

type MaxPagesResponse

type MaxPagesResponse struct {
	MaxPages   int   `json:"max_pages" example:"14"`
	TotalCount int64 `json:"total_count" example:"134"`
}

type MinioUploadEvent

type MinioUploadEvent struct {
	Records []struct {
		S3 struct {
			Bucket struct {
				Name string `json:"name"` // maps to "name" in JSON
			} `json:"bucket"`
			Object struct {
				Key string `json:"key"` // maps to "key" in JSON
			} `json:"object"`
		} `json:"s3"`
	} `json:"Records"`
}

TrackResponse represents the public-facing data for a music track. Using DTOs prevents sensitive internal model fields from being exposed.

type PagingQuery

type PagingQuery struct {
	Limit int `form:"limit,default=10" binding:"gte=1"`
	Page  int `form:"page,default=1" binding:"gte=1"`
}

type RatingResponse

type RatingResponse struct {
	Message string  `json:"message" example:"Rating saved successfully"`
	ID      string  `json:"id,omitempty" example:"123e4567-e89b-12d3-a456-426614174000"`
	Count   int     `json:"count" example:"42"`
	Value   float64 `json:"value" example:"8.5"`
}

type RefuseFriendRequest

type RefuseFriendRequest struct {
	WithRequestID
}

type RemoveFriendRequest

type RemoveFriendRequest struct {
	FriendID uuid.UUID `json:"friend_id"`
}

type ResetPasswordRequest

type ResetPasswordRequest struct {
	Email string `json:"email" binding:"required,email"`
}

type SendFriendRequest

type SendFriendRequest struct {
	To uuid.UUID `json:"to"`
}

type SignUpRequest

type SignUpRequest struct {
	Username string `json:"username" binding:"required,min=3,alphanum"`
	Email    string `json:"email" binding:"required,email"`
	Password string `json:"password" binding:"required,min=6"`
	Avatar   string `json:"avatar"` // Optional
}

type UpdateCommentRequest

type UpdateCommentRequest struct {
	Content string `json:"content" binding:"required,max=3000"`
}

2. INPUT (Update)

type UpdateProjectRequest

type UpdateProjectRequest struct {
	Name        string          `json:"name" binding:"omitempty,min=1,max=100"`
	Description string          `json:"description" binding:"omitempty,max=500"`
	Visibility  string          `json:"visibility" binding:"omitempty,oneof=public private friends"`
	JSONProject json.RawMessage `json:"json_project" binding:"omitempty" swaggertype:"object"`
}

2. INPUT (Update an existing Project)

type UpdateTrackRequest

type UpdateTrackRequest struct {
	HasObjectKey
	Name      string `json:"name" binding:"omitempty,min=1,max=100"`
	ObjectKey string `json:"object_key" binding:"omitempty"`
}

func (UpdateTrackRequest) GetObjectKey

func (req UpdateTrackRequest) GetObjectKey() string

type UpdateUserRequest

type UpdateUserRequest struct {
	Username string `json:"username" binding:"omitempty"`
	Avatar   string `json:"avatar" binding:"omitempty,url"`
}

type UploadAvatarURLRequest

type UploadAvatarURLRequest struct {
	Filename    string `json:"filename" binding:"required"`
	ContentType string `json:"content_type" binding:"required"`
}

type UploadFile

type UploadFile struct {
	Filename    string `json:"filename" binding:"required"`
	ContentType string `json:"content-type" binding:"required"`
	IsPublic    bool   `json:"is_public"`
}

type UpsertRatingRequest

type UpsertRatingRequest struct {
	Value    int    `json:"value" binding:"required,min=1,max=10"`
	TrackID  string `json:"track_id" binding:"required,uuid"`
	AuthorID string `json:"author_id" binding:"required,uuid"`
}

1. INPUT (Upsert) We only need the value, track, and author.

type UserSummary

type UserSummary struct {
	ID       uuid.UUID `json:"id"`
	Username string    `json:"username"`
	Avatar   string    `json:"avatar"`
}

UserSummary is used in Tracks, Comments, and Ratings to show the author without revealing sensitive data like email or password.

type WithRequestID

type WithRequestID struct {
	RequestID uuid.UUID `json:"request_id"`
}

type WithdrawFriendRequest

type WithdrawFriendRequest struct {
	ReceiverID uuid.UUID `json:"receiver_id"`
}

Jump to

Keyboard shortcuts

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