👽 Update attachment reference to string

This commit is contained in:
LittleSheep 2024-08-18 21:29:55 +08:00
parent 1bc687eba6
commit dfa3b6b362
4 changed files with 9 additions and 34 deletions

2
go.mod
View File

@ -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

6
go.sum
View File

@ -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=

View File

@ -26,7 +26,7 @@ type Event struct {
type EventMessageBody struct {
Text string `json:"text,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Attachments []uint `json:"attachments,omitempty"`
Attachments []string `json:"attachments,omitempty"`
QuoteEvent uint `json:"quote_event,omitempty"`
RelatedEvent uint `json:"related_event,omitempty"`
RelatedUsers []uint `json:"related_users,omitempty"`

View File

@ -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
}