Emit updated events for communication resources on mark
This commit is contained in:
parent
633abd19a9
commit
d992eee560
2 changed files with 9 additions and 2 deletions
|
|
@ -3,14 +3,14 @@ package platform
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||||
//"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/public/enum"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/public/model"
|
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/public/model"
|
||||||
querypublic "github.com/Gleipnir-Technology/nidus-sync/db/query/public"
|
querypublic "github.com/Gleipnir-Technology/nidus-sync/db/query/public"
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/lint"
|
"github.com/Gleipnir-Technology/nidus-sync/lint"
|
||||||
//"github.com/Gleipnir-Technology/jet/postgres"
|
"github.com/Gleipnir-Technology/nidus-sync/platform/event"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CommunicationsForOrganization(ctx context.Context, org_id int64) ([]model.Communication, error) {
|
func CommunicationsForOrganization(ctx context.Context, org_id int64) ([]model.Communication, error) {
|
||||||
|
|
@ -63,5 +63,7 @@ func communicationMark(ctx context.Context, user User, comm_id int32, status mod
|
||||||
if err := txn.Commit(ctx); err != nil {
|
if err := txn.Commit(ctx); err != nil {
|
||||||
return fmt.Errorf("commit: %w", err)
|
return fmt.Errorf("commit: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.Updated(event.TypeCommunication, user.Organization.ID, strconv.Itoa(int(comm_id)))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ type ResourceType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TypeUnknown = iota
|
TypeUnknown = iota
|
||||||
|
TypeCommunication
|
||||||
TypeFileCSV
|
TypeFileCSV
|
||||||
TypeNoteAudio
|
TypeNoteAudio
|
||||||
TypeNoteImage
|
TypeNoteImage
|
||||||
|
|
@ -151,6 +152,8 @@ func Send(env Envelope) {
|
||||||
}
|
}
|
||||||
func resourceString(t ResourceType) string {
|
func resourceString(t ResourceType) string {
|
||||||
switch t {
|
switch t {
|
||||||
|
case TypeCommunication:
|
||||||
|
return "sync:communication"
|
||||||
case TypeFileCSV:
|
case TypeFileCSV:
|
||||||
return "sync:filecsv"
|
return "sync:filecsv"
|
||||||
case TypeNoteAudio:
|
case TypeNoteAudio:
|
||||||
|
|
@ -179,6 +182,8 @@ func resourceString(t ResourceType) string {
|
||||||
}
|
}
|
||||||
func makeURI(t ResourceType, id string) string {
|
func makeURI(t ResourceType, id string) string {
|
||||||
switch t {
|
switch t {
|
||||||
|
case TypeCommunication:
|
||||||
|
return config.MakeURLNidus("/api/communication/%s", id)
|
||||||
case TypeFileCSV:
|
case TypeFileCSV:
|
||||||
return config.MakeURLNidus("/api/upload/%s", id)
|
return config.MakeURLNidus("/api/upload/%s", id)
|
||||||
case TypeNoteAudio:
|
case TypeNoteAudio:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue