Draft: big refactor

This commit is contained in:
2025-09-16 16:03:27 +08:00
parent f527230f1e
commit c4f2b0af25
42 changed files with 684 additions and 215 deletions

View File

@@ -1,47 +0,0 @@
package models
import (
"fmt"
"github.com/uptrace/bun"
)
type RoomType int
const (
RoomTypeWordle RoomType = iota
)
var (
RoomTypeStr = []string{"Wordle"}
)
type RoomStatus int
const (
RoomStatusWaiting RoomStatus = iota
RoomStatusPlaying
RoomStatusEnded
)
var (
RoomStatusStr = []string{"Waiting", "Playing", "Ended"}
)
type Room struct {
bun.BaseModel `bun:"table:room"`
Id int `bun:"id,pk,autoincrement"`
Creater string `bun:"creater"`
Type RoomType `bun:"type"`
Status RoomStatus `bun:"status"`
}
func (self Room) View() string {
return fmt.Sprintf("%2d. %10s %10s [%s]",
self.Id,
self.Creater,
RoomTypeStr[self.Type],
RoomStatusStr[self.Status],
)
}