-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Get all partners - Get partner by ID - Create partner
- Loading branch information
Showing
3 changed files
with
93 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from pydantic import BaseModel, Field | ||
from typing import List, Optional, Dict, Any, Union | ||
|
||
|
||
class PaginatedResponse(BaseModel): | ||
page: Optional[int] = Field(None, description="The current page number.") | ||
per_page: Optional[int] = Field(None, description="The number of items per page.") | ||
total: Optional[int] = Field(None, description="The total number of items.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from pydantic import BaseModel, Field | ||
from typing import List, Optional, Dict, Any, Union | ||
from .common import PaginatedResponse | ||
|
||
|
||
class BasePartner(BaseModel): | ||
name: Optional[str] = Field(None, description="Name of the partner organization.") | ||
url: Optional[str] = Field(None, description="Website URL of the partner.") | ||
contact_email: Optional[str] = Field(None, description="Contact email for the partner organization.") | ||
|
||
|
||
class CreatePartner(BasePartner, BaseModel): | ||
name: Optional[str] = Field(None, description="Name of the partner organization.") | ||
url: Optional[str] = Field(None, description="Website URL of the partner.") | ||
contact_email: Optional[str] = Field(None, description="Contact email for the partner organization.") | ||
|
||
|
||
class UpdatePartner(BasePartner, BaseModel): | ||
name: Optional[str] = Field(None, description="Name of the partner organization.") | ||
url: Optional[str] = Field(None, description="Website URL of the partner.") | ||
contact_email: Optional[str] = Field(None, description="Contact email for the partner organization.") | ||
|
||
|
||
class Partner(BasePartner, BaseModel): | ||
name: Optional[str] = Field(None, description="Name of the partner organization.") | ||
url: Optional[str] = Field(None, description="Website URL of the partner.") | ||
contact_email: Optional[str] = Field(None, description="Contact email for the partner organization.") | ||
uid: Optional[str] = Field(None, description="Unique identifier for the partner.") | ||
members: Optional[str] = Field(None, description="Url to get all members of the partner.") | ||
reported_incidents: Optional[str] = Field(None, description="Url to get all incidents reported by the partner.") | ||
|
||
|
||
class PartnerList(PaginatedResponse, BaseModel): | ||
results: Optional[List[Partner]] = None | ||
|
||
|
||
class MemberBase(BaseModel): | ||
partner_uid: Optional[str] = Field(None, description="Unique identifier for the partner.") | ||
user_uid: Optional[str] = Field(None, description="Unique identifier for the user.") | ||
role: Optional[str] = Field(None, description="Role of the user.") | ||
is_active: Optional[bool] = Field(None, description="Whether the user is active.") | ||
|
||
|
||
class Member(MemberBase, BaseModel): | ||
partner_uid: Optional[str] = Field(None, description="Unique identifier for the partner.") | ||
user_uid: Optional[str] = Field(None, description="Unique identifier for the user.") | ||
role: Optional[str] = Field(None, description="Role of the user.") | ||
is_active: Optional[bool] = Field(None, description="Whether the user is active.") | ||
uid: Optional[str] = Field(None, description="Unique identifier for the user.") | ||
date_joined: Optional[str] = Field(None, description="Date the user joined the partner organizaation.") | ||
|
||
|
||
class AddMember(MemberBase, BaseModel): | ||
partner_uid: Optional[str] = Field(None, description="Unique identifier for the partner.") | ||
user_uid: Optional[str] = Field(None, description="Unique identifier for the user.") | ||
role: Optional[str] = Field(None, description="Role of the user.") | ||
is_active: Optional[bool] = Field(None, description="Whether the user is active.") | ||
|
||
|
||
class MemberList(PaginatedResponse, BaseModel): | ||
results: Optional[List[Member]] = None |