package client import ( "context" "fmt" "github.com/topfans/backend/pkg/logger" pbCommon "github.com/topfans/backend/pkg/proto/common" pbGallery "github.com/topfans/backend/pkg/proto/gallery" "go.uber.org/zap" ) type GalleryServiceClient interface { RemoveExhibitionByAsset(ctx context.Context, assetID int64) error } type galleryServiceClient struct { client pbGallery.GalleryService } func NewGalleryServiceClient(client pbGallery.GalleryService) GalleryServiceClient { return &galleryServiceClient{client: client} } func (c *galleryServiceClient) RemoveExhibitionByAsset(ctx context.Context, assetID int64) error { logger.Logger.Debug("Calling GalleryService.RemoveExhibitionByAsset", zap.Int64("asset_id", assetID)) resp, err := c.client.RemoveExhibitionByAsset(ctx, &pbGallery.RemoveExhibitionByAssetRequest{ AssetId: assetID, }) if err != nil { logger.Logger.Error("GalleryService.RemoveExhibitionByAsset failed", zap.Error(err)) return err } if resp.Base.Code != pbCommon.StatusCode_STATUS_OK { logger.Logger.Warn("RemoveExhibitionByAsset non-zero code", zap.Int32("code", int32(resp.Base.Code)), zap.String("message", resp.Base.Message)) return fmt.Errorf("RemoveExhibitionByAsset failed with code: %d, message: %s", resp.Base.Code, resp.Base.Message) } return nil }