Skip to content

Commit

Permalink
moving up
Browse files Browse the repository at this point in the history
  • Loading branch information
gouravmpk committed Jan 17, 2024
1 parent 39b1e4f commit 969fe8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ type Organization struct {
Budget uint `json:"budget,omitempty"`
Website string `json:"website" validate:"omitempty,uri"`
Github string `json:"github" validate:"omitempty,uri"`
Description string `json:"description"`
Description string `json:"description" validate:"omitempty,lte=200"`
}

type OrganizationShort struct {
Expand Down
11 changes: 5 additions & 6 deletions handlers/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func NewOrganizationHandler(db db.Database) *organizationHandler {
func (oh *organizationHandler) CreateOrEditOrganization(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string)
if pubKeyFromAuth == "" {
fmt.Println("no pubkey from auth")
w.WriteHeader(http.StatusUnauthorized)
return
}
now := time.Now()

org := db.Organization{}
Expand Down Expand Up @@ -65,12 +70,6 @@ func (oh *organizationHandler) CreateOrEditOrganization(w http.ResponseWriter, r
}
}

if pubKeyFromAuth == "" {
fmt.Println("no pubkey from auth")
w.WriteHeader(http.StatusUnauthorized)
return
}

// Validate struct data
err = db.Validate.Struct(org)
if err != nil {
Expand Down

0 comments on commit 969fe8a

Please sign in to comment.