From dfa3b6b362e2dde300965bd9f5c71e398ff31443 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 18 Aug 2024 21:29:55 +0800 Subject: [PATCH] :alien: Update attachment reference to string --- go.mod | 2 +- go.sum | 6 ++---- pkg/internal/models/events.go | 12 ++++++------ pkg/internal/services/attachments.go | 23 ----------------------- 4 files changed, 9 insertions(+), 34 deletions(-) delete mode 100644 pkg/internal/services/attachments.go diff --git a/go.mod b/go.mod index 8bdda22..74db51f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22 toolchain go1.22.1 require ( - git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65 + git.solsynth.dev/hydrogen/dealer v0.0.0-20240817155242-38b52aec2fb0 git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 github.com/go-playground/validator/v10 v10.17.0 github.com/gofiber/fiber/v2 v2.52.4 diff --git a/go.sum b/go.sum index 9a74847..0690018 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,7 @@ -git.solsynth.dev/hydrogen/dealer v0.0.0-20240717035851-96b96912ed64 h1:1+3LKTvVpEkQdMRbuRQuKhzm93KAlg/LUbHbZPDo8ZA= -git.solsynth.dev/hydrogen/dealer v0.0.0-20240717035851-96b96912ed64/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA= -git.solsynth.dev/hydrogen/dealer v0.0.0-20240717054512-da433c88615a h1:08YaBgZtkrPfiw08l4RjtKI1fdt6wlHc3Ea7NDFtLPg= -git.solsynth.dev/hydrogen/dealer v0.0.0-20240717054512-da433c88615a/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA= git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65 h1:p9PIsp5RyrLdlOR7MXyeGBx04v3+1IMEEBBV22fJZPo= git.solsynth.dev/hydrogen/dealer v0.0.0-20240719153055-607eba001f65/go.mod h1:oPdUxLy6TFeRxiRC/BoNb3YUNcnSiOnJrzFTnCPSoCA= +git.solsynth.dev/hydrogen/dealer v0.0.0-20240817155242-38b52aec2fb0 h1:2YAKTqgyU+CjP0+m8S29xTqYBerQs/PQIOLAXeeaxzY= +git.solsynth.dev/hydrogen/dealer v0.0.0-20240817155242-38b52aec2fb0/go.mod h1:IZd94qZZIj+MO9EqjGDqnAD9nWurlNPyhVPKemAY5lw= git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 h1:40BUsQMNXjqHyytkyF9py1HjTAWlRgO6R57YXUrHNy4= git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745/go.mod h1:FsQGSLTl0gvo+9Jmbot02S72suyF9tFTrzDj70Xhifo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= diff --git a/pkg/internal/models/events.go b/pkg/internal/models/events.go index af73d73..0dd328d 100644 --- a/pkg/internal/models/events.go +++ b/pkg/internal/models/events.go @@ -24,10 +24,10 @@ type Event struct { // Event Payloads type EventMessageBody struct { - Text string `json:"text,omitempty"` - Algorithm string `json:"algorithm,omitempty"` - Attachments []uint `json:"attachments,omitempty"` - QuoteEvent uint `json:"quote_event,omitempty"` - RelatedEvent uint `json:"related_event,omitempty"` - RelatedUsers []uint `json:"related_users,omitempty"` + Text string `json:"text,omitempty"` + Algorithm string `json:"algorithm,omitempty"` + Attachments []string `json:"attachments,omitempty"` + QuoteEvent uint `json:"quote_event,omitempty"` + RelatedEvent uint `json:"related_event,omitempty"` + RelatedUsers []uint `json:"related_users,omitempty"` } diff --git a/pkg/internal/services/attachments.go b/pkg/internal/services/attachments.go deleted file mode 100644 index 35f9140..0000000 --- a/pkg/internal/services/attachments.go +++ /dev/null @@ -1,23 +0,0 @@ -package services - -import ( - "context" - "git.solsynth.dev/hydrogen/dealer/pkg/hyper" - "git.solsynth.dev/hydrogen/messaging/pkg/internal/gap" - - "git.solsynth.dev/hydrogen/paperclip/pkg/proto" - "github.com/samber/lo" -) - -func CheckAttachmentByIDExists(id uint, usage string) bool { - pc, err := gap.H.GetServiceGrpcConn(hyper.ServiceTypeAuthProvider) - if err != nil { - return false - } - _, err = proto.NewAttachmentsClient(pc).CheckAttachmentExists(context.Background(), &proto.AttachmentLookupRequest{ - Id: lo.ToPtr(uint64(id)), - Usage: &usage, - }) - - return err == nil -}