feat: improve group owner and status display
This commit is contained in:
@@ -70,10 +70,14 @@ func (s *sSysImGroup) List(ctx context.Context, in *sysin.ImGroupListInp) (list
|
||||
func (s *sSysImGroup) groupModel(ctx context.Context, db gdb.DB) *gdb.Model {
|
||||
return db.Model("im_topics t").Safe().Ctx(ctx).
|
||||
LeftJoin("im_group_settings gs", "gs.topic = t.name").
|
||||
LeftJoin("im_users owner", "owner.id = COALESCE(gs.owner_user_id, t.owner)").
|
||||
LeftJoin("im_user_profiles owner_profile", "owner_profile.user_id = COALESCE(gs.owner_user_id, t.owner)").
|
||||
Fields(
|
||||
"t.name topic",
|
||||
"t.state",
|
||||
"COALESCE(gs.owner_user_id, t.owner) owner_id",
|
||||
"COALESCE(NULLIF(owner_profile.nickname, ''), owner.username, '') owner_nickname",
|
||||
"COALESCE(owner.username, '') owner_username",
|
||||
"t.seqid seq_id",
|
||||
"t.delid del_id",
|
||||
"t.subcnt sub_cnt",
|
||||
@@ -137,10 +141,14 @@ func (s *sSysImGroup) View(ctx context.Context, in *sysin.ImGroupViewInp) (res *
|
||||
|
||||
err = db.Model("im_topics t").Safe().Ctx(ctx).
|
||||
LeftJoin("im_group_settings gs", "gs.topic = t.name").
|
||||
LeftJoin("im_users owner", "owner.id = COALESCE(gs.owner_user_id, t.owner)").
|
||||
LeftJoin("im_user_profiles owner_profile", "owner_profile.user_id = COALESCE(gs.owner_user_id, t.owner)").
|
||||
Fields(
|
||||
"t.name topic",
|
||||
"t.state",
|
||||
"COALESCE(gs.owner_user_id, t.owner) owner_id",
|
||||
"COALESCE(NULLIF(owner_profile.nickname, ''), owner.username, '') owner_nickname",
|
||||
"COALESCE(owner.username, '') owner_username",
|
||||
"t.seqid seq_id",
|
||||
"t.delid del_id",
|
||||
"t.subcnt sub_cnt",
|
||||
|
||||
Reference in New Issue
Block a user