增加群组创建、邀请与成员权限管理
This commit is contained in:
1 parent
b1f55df263
commit
99a741e6da
13 files changed
+620
-5
No files matched your search
@@ -16,6 +16,7 @@ import (
|
||||
"xhchat/server/internal/account"
|
||||
"xhchat/server/internal/contacts"
|
||||
"xhchat/server/internal/delivery"
|
||||
"xhchat/server/internal/groups"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/redis/go-redis/v9"
|
||||
@@ -25,14 +26,15 @@ type API struct {
|
||||
accounts *account.Store
|
||||
contacts *contacts.Store
|
||||
delivery *delivery.Store
|
||||
groups *groups.Store
|
||||
redis *redis.Client
|
||||
origins map[string]bool
|
||||
hashSlots chan struct{}
|
||||
ready func(context.Context) error
|
||||
}
|
||||
|
||||
func New(accounts *account.Store, contactStore *contacts.Store, envelopeStore *delivery.Store, cache *redis.Client, origins map[string]bool, ready func(context.Context) error) http.Handler {
|
||||
a := &API{accounts: accounts, contacts: contactStore, delivery: envelopeStore, redis: cache, origins: origins, hashSlots: make(chan struct{}, 4), ready: ready}
|
||||
func New(accounts *account.Store, contactStore *contacts.Store, envelopeStore *delivery.Store, groupStore *groups.Store, cache *redis.Client, origins map[string]bool, ready func(context.Context) error) http.Handler {
|
||||
a := &API{accounts: accounts, contacts: contactStore, delivery: envelopeStore, groups: groupStore, redis: cache, origins: origins, hashSlots: make(chan struct{}, 4), ready: ready}
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, _ *http.Request) { respond(w, 200, map[string]string{"status": "ok"}) })
|
||||
mux.HandleFunc("GET /readyz", a.readiness)
|
||||
@@ -58,6 +60,10 @@ func New(accounts *account.Store, contactStore *contacts.Store, envelopeStore *d
|
||||
mux.HandleFunc("POST /api/v1/attachments/{id}", a.authorized(a.uploadAttachment))
|
||||
mux.HandleFunc("GET /api/v1/attachments/{id}", a.authorized(a.downloadAttachment))
|
||||
mux.HandleFunc("GET /api/v1/mls-local-key", a.authorized(a.localMLSKey))
|
||||
mux.HandleFunc("GET /api/v1/groups", a.authorized(a.listGroups))
|
||||
mux.HandleFunc("POST /api/v1/groups", a.authorized(a.createGroup))
|
||||
mux.HandleFunc("GET /api/v1/groups/{id}", a.authorized(a.groupDetail))
|
||||
mux.HandleFunc("POST /api/v1/groups/{id}", a.authorized(a.changeGroup))
|
||||
return a.boundary(mux)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user