Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,10 @@ func (app *App) UpdateHistoryCall(ctx context.Context, domainId int64, id string
return list[0], nil
}

func (app *App) PatchHistoryCallAttempt(ctx context.Context, patch *model.PatchHistoryCallAttempt) (*model.PatchHistoryAttemptResult, model.AppError) {
return app.Store.Call().PatchHistoryCallAttempt(ctx, patch)
}

/*

func (app *App) createOutboundCallToUser(domainId int64, req *model.OutboundCallRequest, from, to *model.UserCallInfo) (*model.CallRequest, model.AppError) {
Expand Down
4 changes: 0 additions & 4 deletions app/cc_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,3 @@ func (app *App) IsAgentChatChannelOnline(ctx context.Context, agentId int32) (bo
func (app *App) MemberQueueId(ctx context.Context, domainId int64, memberId int64) (int64, model.AppError) {
return app.Store.Member().QueueId(ctx, domainId, memberId)
}

func (app *App) MutateHistoryAttemptResult(ctx context.Context, mutation *model.MutateHistoryAttempt) (*model.AttemptHistory, model.AppError) {
return app.Store.Member().MutateHistoryAttemptResult(ctx, mutation)
}
22 changes: 22 additions & 0 deletions controller/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,25 @@ func (c *Controller) SetContactCall(ctx context.Context, session *auth_manager.S

return c.app.SetCallContactId(ctx, session.Domain(0), session.UserId, id, contactId)
}

func (c *Controller) PatchHistoryCallAttempt(ctx context.Context, patch *model.PatchHistoryCallAttempt) (*model.PatchHistoryAttemptResult, model.AppError) {
session, err := c.GetSessionFromCtx(ctx)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Виклик GetSessionFromCtx має здійснюватися через c.app, оскільки цей метод належить структурі App, а не Controller.

Suggested change
session, err := c.GetSessionFromCtx(ctx)
session, err := c.app.GetSessionFromCtx(ctx)

if err != nil {
return nil, err
}

permission := session.GetPermission(model.PERMISSION_SCOPE_CALL)
if !permission.CanUpdate() {
return nil, c.app.MakePermissionError(session, permission, auth_manager.PERMISSION_ACCESS_UPDATE)
}

if err := patch.TryUseDomain(session); err != nil {
return nil, err
}

if err := patch.Validate(); err != nil {
return nil, err
}

return c.app.PatchHistoryCallAttempt(ctx, patch)
}
20 changes: 0 additions & 20 deletions controller/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,3 @@ func (c *Controller) ResetMembersCount(ctx context.Context, query *model.ResetMe

return c.app.ResetMembersCount(ctx, session.Domain(0), query)
}

func (c *Controller) MutateHistoryAttemptResult(ctx context.Context, mutation *model.MutateHistoryAttempt) (*model.AttemptHistory, model.AppError) {
session, err := c.app.GetSessionFromCtx(ctx)
if err != nil {
return nil, err
}

permission := session.GetPermission(model.PERMISSION_SCOPE_CC_QUEUE)
if !permission.CanUpdate() {
return nil, c.app.MakePermissionError(session, permission, auth_manager.PERMISSION_ACCESS_UPDATE)
}

mutation.DomainID = session.Domain(0)

if err := mutation.Validate(); err != nil {
return nil, err
}

return c.app.MutateHistoryAttemptResult(ctx, mutation)
}
Loading
Loading