mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-10-22 12:35:47 +00:00
feat: emojis for teams
This commit is contained in:
@@ -15,8 +15,8 @@ type Team struct {
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
||||
Emoji null.String `db:"emoji" json:"emoji"`
|
||||
Name string `db:"name" json:"name"`
|
||||
ConversationAssignmentType string `db:"conversation_assignment_type" json:"conversation_assignment_type"`
|
||||
Timezone string `db:"timezone" json:"timezone"`
|
||||
ConversationAssignmentType string `db:"conversation_assignment_type" json:"conversation_assignment_type,omitempty"`
|
||||
Timezone string `db:"timezone" json:"timezone,omitempty"`
|
||||
BusinessHoursID int `db:"business_hours_id" json:"business_hours_id,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ JOIN teams t ON t.id = tm.team_id
|
||||
WHERE t.id = $1;
|
||||
|
||||
-- name: insert-team
|
||||
INSERT INTO teams (name, timezone, conversation_assignment_type, business_hours_id) VALUES ($1, $2, $3, $4) RETURNING id;
|
||||
INSERT INTO teams (name, timezone, conversation_assignment_type, business_hours_id, emoji) VALUES ($1, $2, $3, $4, $5) RETURNING id;
|
||||
|
||||
-- name: update-team
|
||||
UPDATE teams set name = $2, timezone = $3, conversation_assignment_type = $4, business_hours_id = $5 where id = $1;
|
||||
UPDATE teams set name = $2, timezone = $3, conversation_assignment_type = $4, business_hours_id = $5, emoji = $6 where id = $1;
|
||||
|
||||
-- name: upsert-user-teams
|
||||
WITH delete_old_teams AS (
|
||||
|
||||
@@ -102,8 +102,8 @@ func (u *Manager) Get(id int) (models.Team, error) {
|
||||
}
|
||||
|
||||
// Create creates a new team.
|
||||
func (u *Manager) Create(name, timezone, conversationAssignmentType string, businessHrsID int) error {
|
||||
if _, err := u.q.InsertTeam.Exec(name, timezone, conversationAssignmentType, businessHrsID); err != nil {
|
||||
func (u *Manager) Create(name, timezone, conversationAssignmentType string, businessHrsID int, emoji string) error {
|
||||
if _, err := u.q.InsertTeam.Exec(name, timezone, conversationAssignmentType, businessHrsID, emoji); err != nil {
|
||||
u.lo.Error("error inserting team", "error", err)
|
||||
return envelope.NewError(envelope.GeneralError, "Error creating team", nil)
|
||||
}
|
||||
@@ -111,8 +111,8 @@ func (u *Manager) Create(name, timezone, conversationAssignmentType string, busi
|
||||
}
|
||||
|
||||
// Update updates an existing team.
|
||||
func (u *Manager) Update(id int, name, timezone, conversationAssignmentType string, businessHrsID int) error {
|
||||
if _, err := u.q.UpdateTeam.Exec(id, name, timezone, conversationAssignmentType, businessHrsID); err != nil {
|
||||
func (u *Manager) Update(id int, name, timezone, conversationAssignmentType string, businessHrsID int, emoji string) error {
|
||||
if _, err := u.q.UpdateTeam.Exec(id, name, timezone, conversationAssignmentType, businessHrsID, emoji); err != nil {
|
||||
u.lo.Error("error updating team", "error", err)
|
||||
return envelope.NewError(envelope.GeneralError, "Error updating team", nil)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ SELECT
|
||||
u.last_name,
|
||||
u.roles,
|
||||
COALESCE(
|
||||
(SELECT json_agg(json_build_object('id', t.id, 'name', t.name))
|
||||
(SELECT json_agg(json_build_object('id', t.id, 'name', t.name, 'emoji', t.emoji))
|
||||
FROM team_members tm
|
||||
JOIN teams t ON tm.team_id = t.id
|
||||
WHERE tm.user_id = u.id),
|
||||
|
||||
Reference in New Issue
Block a user