chore: tweak store definition

This commit is contained in:
Steven
2024-04-13 11:54:37 +08:00
parent 6ee3b0f704
commit cebc46adc7
25 changed files with 298 additions and 895 deletions

View File

@ -2,10 +2,18 @@ package store
import (
"context"
storepb "github.com/usememos/memos/proto/gen/store"
)
type Webhook struct {
ID int32
CreatedTs int64
UpdatedTs int64
CreatorID int32
RowStatus RowStatus
Name string
Url string
}
type FindWebhook struct {
ID *int32
CreatorID *int32
@ -13,7 +21,7 @@ type FindWebhook struct {
type UpdateWebhook struct {
ID int32
RowStatus *storepb.RowStatus
RowStatus *RowStatus
Name *string
URL *string
}
@ -22,15 +30,15 @@ type DeleteWebhook struct {
ID int32
}
func (s *Store) CreateWebhook(ctx context.Context, create *storepb.Webhook) (*storepb.Webhook, error) {
func (s *Store) CreateWebhook(ctx context.Context, create *Webhook) (*Webhook, error) {
return s.driver.CreateWebhook(ctx, create)
}
func (s *Store) ListWebhooks(ctx context.Context, find *FindWebhook) ([]*storepb.Webhook, error) {
func (s *Store) ListWebhooks(ctx context.Context, find *FindWebhook) ([]*Webhook, error) {
return s.driver.ListWebhooks(ctx, find)
}
func (s *Store) GetWebhook(ctx context.Context, find *FindWebhook) (*storepb.Webhook, error) {
func (s *Store) GetWebhook(ctx context.Context, find *FindWebhook) (*Webhook, error) {
list, err := s.ListWebhooks(ctx, find)
if err != nil {
return nil, err
@ -41,7 +49,7 @@ func (s *Store) GetWebhook(ctx context.Context, find *FindWebhook) (*storepb.Web
return list[0], nil
}
func (s *Store) UpdateWebhook(ctx context.Context, update *UpdateWebhook) (*storepb.Webhook, error) {
func (s *Store) UpdateWebhook(ctx context.Context, update *UpdateWebhook) (*Webhook, error) {
return s.driver.UpdateWebhook(ctx, update)
}