Skip to content

Commit

Permalink
chore: remove unused validation
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed May 31, 2024
1 parent a4187c7 commit df7ec6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions internal/nostr/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const (
REQUEST_EVENT_PUBLISH_CONFIRMED = "CONFIRMED"
REQUEST_EVENT_PUBLISH_FAILED = "FAILED"
EVENT_PUBLISHED = "PUBLISHED"
EVENT_ALREADY_PUBLISHED = "ALREADY_PUBLISHED"
EVENT_ALREADY_PROCESSED = "ALREADY_PROCESSED"
WEBHOOK_RECEIVED = "WEBHOOK_RECEIVED"
SUBSCRIPTION_CLOSED = "CLOSED"
SUBSCRIPTION_ALREADY_CLOSED = "ALREADY_CLOSED"
)

type Subscription struct {
ID uint
RelayUrl string `validate:"required"`
RelayUrl string
WebhookUrl string
Open bool
Ids *[]string `gorm:"-"`
Expand Down Expand Up @@ -131,7 +131,7 @@ type HandleEventFunc func(event *nostr.Event, subscription *Subscription)

type RequestEvent struct {
ID uint
SubscriptionId *uint `validate:"required"`
SubscriptionId *uint
NostrId string `validate:"required"`
Content string
State string
Expand All @@ -142,7 +142,7 @@ type RequestEvent struct {
type ResponseEvent struct {
ID uint
RequestId *uint
SubscriptionId *uint `validate:"required"`
SubscriptionId *uint
NostrId string `validate:"required"`
Content string
RepliedAt time.Time
Expand Down Expand Up @@ -178,10 +178,10 @@ type NIP47WebhookRequest struct {
}

type NIP47NotificationRequest struct {
RelayUrl string `json:"relayUrl"`
WebhookUrl string `json:"webhookUrl"`
WalletPubkey string `json:"walletPubkey"`
ConnPubkey string `json:"connectionPubkey"`
RelayUrl string `json:"relayUrl"`
WebhookUrl string `json:"webhookUrl"`
WalletPubkey string `json:"walletPubkey"`
ConnPubkey string `json:"connectionPubkey"`
}

type NIP47Response struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (svc *Service) NIP47Handler(c echo.Context) error {

if svc.db.Where("nostr_id = ?", requestData.SignedEvent.ID).First(&RequestEvent{}).RowsAffected != 0 {
return c.JSON(http.StatusBadRequest, NIP47Response{
State: EVENT_ALREADY_PUBLISHED,
State: EVENT_ALREADY_PROCESSED,
})
}

Expand Down Expand Up @@ -402,7 +402,7 @@ func (svc *Service) NIP47WebhookHandler(c echo.Context) error {

if svc.db.Where("nostr_id = ?", requestData.SignedEvent.ID).First(&RequestEvent{}).RowsAffected != 0 {
return c.JSON(http.StatusBadRequest, NIP47Response{
State: EVENT_ALREADY_PUBLISHED,
State: EVENT_ALREADY_PROCESSED,
})
}

Expand Down

0 comments on commit df7ec6b

Please sign in to comment.