[email] Add public email endpoint to list all bots to a hood
This commit is contained in:
parent
5575782b9b
commit
d8c138982d
|
@ -33,6 +33,10 @@ class BodyEmail(BaseModel):
|
|||
return value
|
||||
|
||||
|
||||
class BodyEmailPublic(BaseModel):
|
||||
name: str
|
||||
|
||||
|
||||
class BodyMessage(BaseModel):
|
||||
""" This model shows which values are supplied by the MDA listener script. """
|
||||
|
||||
|
@ -70,6 +74,18 @@ async def get_subscriber(subscriber_id: int, hood=Depends(get_hood)):
|
|||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get(
|
||||
'/public',
|
||||
# TODO response_model
|
||||
operation_id='get_emails_public',
|
||||
)
|
||||
async def email_read_all_public(hood=Depends(get_hood_unauthorized)):
|
||||
if hood.email_enabled:
|
||||
emails = await Email.objects.filter(hood=hood).all()
|
||||
return [BodyEmailPublic(name=email.name) for email in emails]
|
||||
return []
|
||||
|
||||
|
||||
@router.get(
|
||||
'/',
|
||||
# TODO response_model
|
||||
|
|
Loading…
Reference in a new issue