spark-server/internal/module/group/entity/group.go
zhr ae9a71034d feat: implement Spark IM V3 modular monolith
Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:52:11 +08:00

53 lines
972 B
Go

// Package entity holds group domain types. Persistence belongs in model.
package entity
const (
StatusActive = 1
StatusDissolved = 2
MaxNameLen = 32
MaxMembers = 200
ListDefault = 20
ListMax = 100
MemberListMax = 200
MaxCollageFaces = 9
)
// Group is a type-2 chat. ID is the AUTO_INCREMENT 群号; ConversationID is Snowflake.
type Group struct {
ID int64
ConversationID int64
Name string
Avatar string
OwnerID int64
MutedAll bool
MemberCount int
Status int
CreatedAtMS int64
UpdatedAtMS int64
}
func (g *Group) Active() bool {
return g != nil && g.Status == StatusActive
}
func ClampLimit(limit int) int {
if limit <= 0 {
return ListDefault
}
if limit > ListMax {
return ListMax
}
return limit
}
func ClampMemberLimit(limit int) int {
if limit <= 0 {
return MemberListMax
}
if limit > MemberListMax {
return MemberListMax
}
return limit
}