Skip to content

Commit a3e70fc

Browse files
committed
docs: add swagger docs for add owners function
1 parent 96b2ab2 commit a3e70fc

1 file changed

Lines changed: 192 additions & 0 deletions

File tree

src/docs/swagger.json

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,151 @@
581581
}
582582
}
583583
},
584+
"/api/organization/{organizationId}/addOwner": {
585+
"post": {
586+
"tags": ["Organization"],
587+
"summary": "Add owners to organization",
588+
"description": "Add one or more users as owners to an organization. Requires admin or existing owner permissions.",
589+
"operationId": "addOwners",
590+
"security": [{ "bearerAuth": [] }],
591+
"parameters": [
592+
{
593+
"name": "organizationId",
594+
"in": "path",
595+
"required": true,
596+
"description": "ID of the organization to add owners to",
597+
"schema": {
598+
"type": "string",
599+
"format": "uuid"
600+
}
601+
}
602+
],
603+
"requestBody": {
604+
"description": "User IDs to add as owners",
605+
"required": true,
606+
"content": {
607+
"application/json": {
608+
"schema": {
609+
"$ref": "#/components/schemas/AddOwnersRequest"
610+
},
611+
"examples": {
612+
"basic": {
613+
"value": {
614+
"userIds": [
615+
"550e8400-e29b-41d4-a716-446655440000",
616+
"550e8400-e29b-41d4-a716-446655440001"
617+
]
618+
}
619+
}
620+
}
621+
}
622+
}
623+
},
624+
"responses": {
625+
"200": {
626+
"description": "Owners added successfully",
627+
"content": {
628+
"application/json": {
629+
"schema": {
630+
"$ref": "#/components/schemas/AddOwnersResponse"
631+
},
632+
"examples": {
633+
"success": {
634+
"value": {
635+
"success": true,
636+
"message": "Successfully added 2 owner(s) to the organization",
637+
"data": {
638+
"addedOwners": [
639+
{
640+
"id": "550e8400-e29b-41d4-a716-446655440000",
641+
"name": "John Doe",
642+
"email": "john@example.com"
643+
},
644+
{
645+
"id": "550e8400-e29b-41d4-a716-446655440001",
646+
"name": "Jane Smith",
647+
"email": "jane@example.com"
648+
}
649+
],
650+
"skippedOwners": []
651+
}
652+
}
653+
},
654+
"partial": {
655+
"value": {
656+
"success": true,
657+
"message": "Successfully added 1 owner(s) to the organization",
658+
"data": {
659+
"addedOwners": [
660+
{
661+
"id": "550e8400-e29b-41d4-a716-446655440000",
662+
"name": "John Doe",
663+
"email": "john@example.com"
664+
}
665+
],
666+
"skippedOwners": [
667+
"550e8400-e29b-41d4-a716-446655440001"
668+
]
669+
}
670+
}
671+
}
672+
}
673+
}
674+
}
675+
},
676+
"400": {
677+
"description": "Bad request - Invalid input or non-existent users",
678+
"content": {
679+
"application/json": {
680+
"schema": {
681+
"$ref": "#/components/schemas/ErrorResponse"
682+
},
683+
"examples": {
684+
"validationError": {
685+
"value": {
686+
"success": false,
687+
"message": "\"userIds\" must contain at least 1 items",
688+
"errors": ["\"userIds\" must contain at least 1 items"]
689+
}
690+
},
691+
"invalidUsers": {
692+
"value": {
693+
"success": false,
694+
"message": "One or more specified users do not exist",
695+
"errors": {
696+
"invalidUserIds": [
697+
"550e8400-e29b-41d4-a716-446655440002"
698+
]
699+
}
700+
}
701+
}
702+
}
703+
}
704+
}
705+
},
706+
"403": {
707+
"description": "Forbidden - User lacks permission to add owners",
708+
"content": {
709+
"application/json": {
710+
"schema": {
711+
"$ref": "#/components/schemas/ErrorResponse"
712+
}
713+
}
714+
}
715+
},
716+
"404": {
717+
"description": "Organization not found",
718+
"content": {
719+
"application/json": {
720+
"schema": {
721+
"$ref": "#/components/schemas/ErrorResponse"
722+
}
723+
}
724+
}
725+
}
726+
}
727+
}
728+
},
584729
"/api/users": {
585730
"get": {
586731
"tags": ["Users"],
@@ -1379,6 +1524,53 @@
13791524
}
13801525
}
13811526
},
1527+
"AddOwnersResponse": {
1528+
"type": "object",
1529+
"properties": {
1530+
"success": {
1531+
"type": "boolean",
1532+
"example": true
1533+
},
1534+
"message": {
1535+
"type": "string",
1536+
"example": "Successfully added 2 owner(s) to the organization"
1537+
},
1538+
"data": {
1539+
"type": "object",
1540+
"properties": {
1541+
"addedOwners": {
1542+
"type": "array",
1543+
"items": {
1544+
"type": "object",
1545+
"properties": {
1546+
"id": {
1547+
"type": "string",
1548+
"format": "uuid"
1549+
},
1550+
"name": {
1551+
"type": "string",
1552+
"example": "John Doe"
1553+
},
1554+
"email": {
1555+
"type": "string",
1556+
"format": "email",
1557+
"example": "john@example.com"
1558+
}
1559+
}
1560+
}
1561+
},
1562+
"skippedOwners": {
1563+
"type": "array",
1564+
"items": {
1565+
"type": "string",
1566+
"format": "uuid"
1567+
},
1568+
"description": "User IDs that were already owners and weren't added again"
1569+
}
1570+
}
1571+
}
1572+
}
1573+
},
13821574
"UserListResponse": {
13831575
"type": "object",
13841576
"properties": {

0 commit comments

Comments
 (0)