Feat: login done

This commit is contained in:
2025-09-05 03:59:25 +08:00
parent 6d7074198f
commit f527230f1e
43 changed files with 2090 additions and 93 deletions

47
models/room.go Normal file
View File

@@ -0,0 +1,47 @@
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],
)
}