- 체인 nonce 경쟁 조건 수정 (operatorMu + per-user mutex) - 등록/SSAFY 원자적 트랜잭션 (wallet+profile 롤백 보장) - IdempotencyRequired 미들웨어 (SETNX 원자적 클레임) - 런치 티켓 API (JWT URL 노출 방지) - HttpOnly 쿠키 refresh token - SSAFY OAuth state 파라미터 (CSRF 방지) - Refresh 시 DB 조회로 최신 role 사용 - 공지사항/유저목록 페이지네이션 - BodyLimit 미들웨어 (1MB, upload 제외) - 입력 검증 강화 (닉네임, 게임데이터, 공지 길이) - 에러 메시지 내부 정보 노출 방지 - io.LimitReader (RPC 10MB, SSAFY 1MB) - RequestID 비출력 문자 제거 - 단위 테스트 (auth 11, announcement 9, bossraid 16) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package bossraid
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type RoomStatus string
|
|
|
|
const (
|
|
StatusWaiting RoomStatus = "waiting"
|
|
StatusInProgress RoomStatus = "in_progress"
|
|
StatusCompleted RoomStatus = "completed"
|
|
StatusFailed RoomStatus = "failed"
|
|
)
|
|
|
|
// BossRoom represents a boss raid session room.
|
|
type BossRoom struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
|
SessionName string `json:"sessionName" gorm:"type:varchar(100);uniqueIndex;not null"`
|
|
BossID int `json:"bossId" gorm:"index;not null"`
|
|
Status RoomStatus `json:"status" gorm:"type:varchar(20);index;default:waiting;not null"`
|
|
MaxPlayers int `json:"maxPlayers" gorm:"default:3;not null"`
|
|
// Players is stored as a JSON text column for simplicity.
|
|
// TODO: For better query performance, consider migrating to a junction table
|
|
// (boss_room_players with room_id + username columns).
|
|
Players string `json:"players" gorm:"type:text"` // JSON array of usernames
|
|
StartedAt *time.Time `json:"startedAt,omitempty"`
|
|
CompletedAt *time.Time `json:"completedAt,omitempty"`
|
|
}
|