2024-06-22 09:29:53 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-07-16 02:53:02 +00:00
|
|
|
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
2024-06-22 09:29:53 +00:00
|
|
|
"git.solsynth.dev/hydrogen/interactive/pkg/internal/gap"
|
|
|
|
"git.solsynth.dev/hydrogen/paperclip/pkg/proto"
|
|
|
|
"github.com/samber/lo"
|
|
|
|
)
|
|
|
|
|
|
|
|
func CheckAttachmentByIDExists(id uint, usage string) bool {
|
2024-07-16 02:53:02 +00:00
|
|
|
pc, err := gap.H.GetServiceGrpcConn(hyper.ServiceTypeFileProvider)
|
2024-06-22 09:29:53 +00:00
|
|
|
if err != nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
_, err = proto.NewAttachmentsClient(pc).CheckAttachmentExists(context.Background(), &proto.AttachmentLookupRequest{
|
|
|
|
Id: lo.ToPtr(uint64(id)),
|
|
|
|
Usage: &usage,
|
|
|
|
})
|
|
|
|
return err == nil
|
|
|
|
}
|