add a few handlers

This commit is contained in:
2025-02-03 01:57:22 +01:00
parent 0d6a9a8b32
commit 0479db520b
6 changed files with 362 additions and 147 deletions

View File

@@ -2,34 +2,42 @@ package main
import "time"
// Song represents a song entity
// @Description Song represents a song with metadata
type Song struct {
MD5Hash string
Title string
Artist string
Creator string
Folder string
File string
Audio string
Mapper string
TotalTime time.Duration
Url string
Image string
BeatmapID int `json:"beatmap_id" example:"123456"`
MD5Hash string `json:"md5_hash" example:"abcd1234efgh5678"`
Title string `json:"title" example:"Shape of You"`
Artist string `json:"artist" example:"Ed Sheeran"`
Creator string `json:"creator" example:"JohnDoe"`
Folder string `json:"folder" example:"osu/Songs/123456"`
File string `json:"file" example:"beatmap.osu"`
Audio string `json:"audio" example:"audio.mp3"`
TotalTime time.Duration `json:"total_time" example:"240"`
Url string `json:"url" example:"https://osu.ppy.sh/beatmaps/123456"`
Image string `json:"image" example:"cover.jpg"`
}
// CollectionPreview represents a preview of a song collection
// @Description CollectionPreview contains summary data of a song collection
type CollectionPreview struct {
name string
image string
index int
items int
Name string `json:"name" example:"Favorite Songs"`
Image string `json:"image" example:"cover.jpg"`
Index int `json:"index" example:"1"`
Items int `json:"items" example:"10"`
}
// Collection represents a full song collection
// @Description Collection holds a list of songs
type Collection struct {
name string
items int
Songs []Song
Name string `json:"name" example:"Best of 2023"`
Items int `json:"items" example:"15"`
Songs []Song `json:"songs"`
}
// ActiveSearch represents an active song search query
// @Description ActiveSearch holds search results for a given artist
type ActiveSearch struct {
artist string
Songs []Song
Artist string `json:"artist" example:"Ed Sheeran"`
Songs []Song `json:"songs"`
}