Skip to content

✨(admin) add prototype Admin frontend #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
278 changes: 272 additions & 6 deletions src/backend/core/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,90 @@
}
}
},
"/api/v1.0/contacts/": {
"get": {
"operationId": "contacts_list",
"description": "List contacts with optional filtering by mailbox and search query.\n\nQuery parameters:\n- mailbox_id: Optional UUID to filter contacts by mailbox\n- q: Optional search query for name or email (case insensitive)",
"parameters": [
{
"in": "query",
"name": "mailbox_id",
"schema": {
"type": "string",
"format": "uuid"
},
"description": "Filter contacts by mailbox ID."
},
{
"in": "query",
"name": "q",
"schema": {
"type": "string"
},
"description": "Search contacts by name or email (case insensitive)."
}
],
"tags": [
"contacts"
],
"security": [
{
"cookieAuth": []
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Contact"
}
}
}
},
"description": ""
}
}
}
},
"/api/v1.0/contacts/{id}/": {
"get": {
"operationId": "contacts_retrieve",
"description": "ViewSet for Contact model.",
"parameters": [
{
"in": "path",
"name": "id",
"schema": {
"type": "string"
},
"required": true
}
],
"tags": [
"contacts"
],
"security": [
{
"cookieAuth": []
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Contact"
}
}
},
"description": ""
}
}
}
},
"/api/v1.0/draft/": {
"post": {
"operationId": "draft_create",
Expand Down Expand Up @@ -2244,7 +2328,7 @@
},
"post": {
"operationId": "maildomains_mailboxes_create",
"description": "ViewSet for managing Mailboxes within a specific MailDomain.\nNested under /maildomains/{maildomain_pk}/mailboxes/\nPermissions are checked by IsMailDomainAdmin for the maildomain_pk.\n\nThis viewset serves a different purpose than the one in mailbox.py (/api/v1.0/mailboxes/).\nThat other one is for listing the mailboxes a user has access to in regular app use.\nThis one is for managing mailboxes within a specific maildomain in the admin interface.",
"description": "Create new mailbox in a specific maildomain.",
"parameters": [
{
"in": "path",
Expand All @@ -2259,21 +2343,36 @@
"tags": [
"maildomains"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MailboxAdminCreatePayloadRequest"
}
},
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/MailboxAdminCreatePayloadRequest"
}
}
},
"required": true
},
"security": [
{
"cookieAuth": []
}
],
"responses": {
"201": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MailboxAdmin"
"$ref": "#/components/schemas/MailboxAdminCreate"
}
}
},
"description": ""
"description": "The new mailbox with one extra field `one_time_password` if identity provider is keycloak."
}
}
}
Expand Down Expand Up @@ -2453,6 +2552,54 @@
}
}
},
"/api/v1.0/maildomains/{maildomain_pk}/users/": {
"get": {
"operationId": "maildomains_users_list",
"description": "Search users by email, first name and last name.",
"parameters": [
{
"in": "path",
"name": "maildomain_pk",
"schema": {
"type": "string",
"format": "uuid"
},
"required": true
},
{
"in": "query",
"name": "q",
"schema": {
"type": "string"
},
"description": "Search maildomains user by full name, short name or email."
}
],
"tags": [
"admin-maildomain-user"
],
"security": [
{
"cookieAuth": []
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
}
}
},
"description": ""
}
}
}
},
"/api/v1.0/messages/": {
"get": {
"operationId": "messages_list",
Expand Down Expand Up @@ -3983,6 +4130,107 @@
"updated_at"
]
},
"MailboxAdminCreate": {
"type": "object",
"description": "Serialize Mailbox details for create admin endpoint, including users with access and\nmetadata.",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"readOnly": true,
"description": "primary key for the record as UUID"
},
"local_part": {
"type": "string",
"readOnly": true
},
"domain_name": {
"type": "string",
"readOnly": true
},
"alias_of": {
"type": "string",
"format": "uuid",
"description": "primary key for the record as UUID",
"readOnly": true,
"nullable": true
},
"accesses": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MailboxAccessNestedUser"
},
"readOnly": true
},
"created_at": {
"type": "string",
"format": "date-time",
"readOnly": true,
"title": "Created on",
"description": "date and time at which a record was created"
},
"updated_at": {
"type": "string",
"format": "date-time",
"readOnly": true,
"title": "Updated on",
"description": "date and time at which a record was last updated"
},
"one_time_password": {
"type": "string",
"nullable": true,
"description": "Fake method just to make the OpenAPI schema valid.",
"readOnly": true
}
},
"required": [
"accesses",
"alias_of",
"created_at",
"domain_name",
"id",
"local_part",
"one_time_password",
"updated_at"
]
},
"MailboxAdminCreateMetadataRequest": {
"type": "object",
"properties": {
"type": {
"$ref": "#/components/schemas/TypeEnum"
},
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
}
},
"required": [
"type"
]
},
"MailboxAdminCreatePayloadRequest": {
"type": "object",
"properties": {
"local_part": {
"type": "string",
"minLength": 1
},
"alias_of": {
"type": "string",
"format": "uuid"
},
"metadata": {
"$ref": "#/components/schemas/MailboxAdminCreateMetadataRequest"
}
},
"required": [
"local_part",
"metadata"
]
},
"MailboxLight": {
"type": "object",
"description": "Serializer for mailbox details in thread access.",
Expand Down Expand Up @@ -4032,7 +4280,8 @@
},
"subject": {
"type": "string",
"readOnly": true
"readOnly": true,
"nullable": true
},
"created_at": {
"type": "string",
Expand Down Expand Up @@ -4501,7 +4750,8 @@
},
"subject": {
"type": "string",
"readOnly": true
"readOnly": true,
"nullable": true
},
"snippet": {
"type": "string",
Expand Down Expand Up @@ -4783,6 +5033,15 @@
"slug"
]
},
"TypeEnum": {
"enum": [
"personal",
"shared",
"redirect"
],
"type": "string",
"description": "* `personal` - personal\n* `shared` - shared\n* `redirect` - redirect"
},
"User": {
"type": "object",
"description": "Serialize users.",
Expand All @@ -4809,9 +5068,16 @@
"type": "string",
"readOnly": true,
"nullable": true
},
"abilities": {
"type": "object",
"additionalProperties": {},
"description": "Return abilities of the logged-in user on the mail domain.",
"readOnly": true
}
},
"required": [
"abilities",
"email",
"full_name",
"id",
Expand Down
21 changes: 21 additions & 0 deletions src/backend/core/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,27 @@ class Meta:
read_only_fields = fields


class MailboxAdminCreateSerializer(MailboxAdminSerializer):
"""
Serialize Mailbox details for create admin endpoint, including users with access and
metadata.
"""

one_time_password = serializers.SerializerMethodField(
read_only=True, required=False
)

def get_one_time_password(self, instance) -> str | None:
"""
Fake method just to make the OpenAPI schema valid.
"""

class Meta:
model = models.Mailbox
fields = MailboxAdminSerializer.Meta.fields + ["one_time_password"]
read_only_fields = fields


class ImportBaseSerializer(serializers.Serializer):
"""Base serializer for import actions that disables create and update."""

Expand Down
Loading
Loading