From d673fc05994352b554c56b1561c4889ec7464447 Mon Sep 17 00:00:00 2001 From: emmdim Date: Thu, 7 Nov 2024 17:53:40 +0100 Subject: [PATCH] Update docs --- api/docs.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ db/types.go | 20 +++++++++---------- 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/api/docs.md b/api/docs.md index 8035733..0f2fc3f 100644 --- a/api/docs.md +++ b/api/docs.md @@ -29,6 +29,7 @@ - [🧑‍💼 Invite organization member](#-invite-organization-member) - [⏳ List pending invitations](#-list-pending-invitations) - [🤝 Accept organization invitation](#-accept-organization-invitation) + - [👥 Organization Subscription Info](#-organization_subscription-info) - [🤠 Available organization members roles](#-available-organization-members-roles) - [🏛️ Available organization types](#-available-organization-types) - [💳 Plans](#-plans) @@ -673,6 +674,60 @@ Only the following parameters can be changed. Every parameter is optional. | `409` | `40901` | `duplicate conflict` | | `500` | `50002` | `internal server error` | +### 👥 Organization subscription info + +* **Path** `/organizations/{address}/subscription` +* **Method** `GET` +* **Request** +```json +{ + "subscriptionDetails":{ + "planID":3, + "startDate":"2024-11-07T15:25:49.218Z", + "endDate":"0001-01-01T00:00:00Z", + "renewalDate":"0001-01-01T00:00:00Z", + "active":true, + "maxCensusSize":10 + }, + "usage":{ + "sentSMS":0, + "sentEmails":0, + "subOrgs":0, + "members":0 + }, + "plan":{ + "id":3, + "name":"free", + "stripeID":"stripe_789", + "default":true, + "organization":{ + "memberships":10, + "subOrgs":5, + "censusSize":10 + }, + "votingTypes":{ + "approval":false, + "ranked":false, + "weighted":true + }, + "features":{ + "personalization":false, + "emailReminder":false, + "smsNotification":false + } + } +} +``` + +* **Errors** + +| HTTP Status | Error code | Message | +|:---:|:---:|:---| +| `401` | `40001` | `user not authorized` | +| `400` | `40009` | `organization not found` | +| `400` | `40011` | `no organization provided` | +| `500` | `50002` | `internal server error` | + ### 🤠 Available organization members roles * **Path** `/organizations/roles` * **Method** `GET` diff --git a/db/types.go b/db/types.go index ee9a5da..c38ce29 100644 --- a/db/types.go +++ b/db/types.go @@ -89,19 +89,19 @@ type Plan struct { } type OrganizationSubscription struct { - PlanID uint64 `bson:"planID"` - StartDate time.Time `bson:"startDate"` - EndDate time.Time `bson:"endDate"` - RenewalDate time.Time `bson:"renewalDate"` - Active bool `bson:"active"` - MaxCensusSize int `bson:"maxCensusSize"` + PlanID uint64 `json:"planID" bson:"planID"` + StartDate time.Time `json:"startDate" bson:"startDate"` + EndDate time.Time `json:"endDate" bson:"endDate"` + RenewalDate time.Time `json:"renewalDate" bson:"renewalDate"` + Active bool `json:"active" bson:"active"` + MaxCensusSize int `json:"maxCensusSize" bson:"maxCensusSize"` } type OrganizationCounters struct { - SentSMS int `bson:"sentSMS"` - SentEmails int `bson:"sentEmails"` - SubOrgs int `bson:"subOrgs"` - Members int `bson:"members"` + SentSMS int `json:"sentSMS" bson:"sentSMS"` + SentEmails int `json:"sentEmails" bson:"sentEmails"` + SubOrgs int `json:"subOrgs" bson:"subOrgs"` + Members int `json:"members" bson:"members"` } type OrganizationInvite struct {