Skip to content

Commit

Permalink
* Adds communications org boolean property
Browse files Browse the repository at this point in the history
* Stores correct country in Organizations POST
  • Loading branch information
emmdim committed Jan 15, 2025
1 parent 0906201 commit 3344598
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
7 changes: 5 additions & 2 deletions api/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ This method invalidates any previous JWT token for the user, so it returns a new
"subdomain": "mysubdomain",
"country": "Germany",
"timezone": "GMT+2",
"language": "EN"
"language": "EN",
"communication": true
}
```
By default, the organization is created with `activated: true`.
Expand Down Expand Up @@ -513,7 +514,8 @@ Only the following parameters can be changed. Every parameter is optional.
"country": "Germany",
"timezone": "GMT+2",
"Language": "EN",
"active": true
"active": true,
"communication": false
}
```

Expand Down Expand Up @@ -548,6 +550,7 @@ Only the following parameters can be changed. Every parameter is optional.
"timezone": "GMT+2",
"Language": "EN",
"active": true,
"communications": true,
"parent": {
"...": "..."
}
Expand Down
2 changes: 2 additions & 0 deletions api/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ func (a *API) createOrganizationHandler(w http.ResponseWriter, r *http.Request)
Type: db.OrganizationType(orgInfo.Type),
Size: orgInfo.Size,
Color: orgInfo.Color,
Country: orgInfo.Country,
Subdomain: orgInfo.Subdomain,
Timezone: orgInfo.Timezone,
Active: true,
Communications: orgInfo.Communications,
TokensPurchased: 0,
TokensRemaining: 0,
Parent: parentOrg,
Expand Down
27 changes: 14 additions & 13 deletions api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ import (

// Organization is the struct that represents an organization in the API
type OrganizationInfo struct {
Address string `json:"address"`
Website string `json:"website"`
CreatedAt string `json:"createdAt"`
Type string `json:"type"`
Size string `json:"size"`
Color string `json:"color"`
Subdomain string `json:"subdomain"`
Country string `json:"country"`
Timezone string `json:"timezone"`
Active bool `json:"active"`
Parent *OrganizationInfo `json:"parent"`
Subscription *db.OrganizationSubscription `json:"subscription"`
Counters *db.OrganizationCounters `json:"counters"`
Address string `json:"address"`
Website string `json:"website"`
CreatedAt string `json:"createdAt"`
Type string `json:"type"`
Size string `json:"size"`
Color string `json:"color"`
Subdomain string `json:"subdomain"`
Country string `json:"country"`
Timezone string `json:"timezone"`
Active bool `json:"active"`
Communications bool `json:"communications"`
Parent *OrganizationInfo `json:"parent"`
Subscription *db.OrganizationSubscription `json:"subscription"`
Counters *db.OrganizationCounters `json:"counters"`
}

// OrganizationMembers is the struct that represents a list of members of
Expand Down
1 change: 1 addition & 0 deletions db/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type Organization struct {
Country string `json:"country" bson:"country"`
Timezone string `json:"timezone" bson:"timezone"`
Active bool `json:"active" bson:"active"`
Communications bool `json:"communications" bson:"communications"`
TokensPurchased uint64 `json:"tokensPurchased" bson:"tokensPurchased"`
TokensRemaining uint64 `json:"tokensRemaining" bson:"tokensRemaining"`
Parent string `json:"parent" bson:"parent"`
Expand Down

0 comments on commit 3344598

Please sign in to comment.