Skip to content

Commit 3e42403

Browse files
author
Lasim
committed
feat: add endpoint to retrieve current user's default team
- Implemented GET /api/teams/me/default to fetch the default team for the authenticated user. - Updated API specifications in both JSON and YAML formats to include the new endpoint and response schemas. - Modified the teams database schema to include an `is_default` boolean field. - Enhanced the TeamService to support fetching the user's default team. - Created a new Vue component for redirecting users to their default team management page. - Updated frontend services and router to handle the new default team functionality. - Added migration scripts to update the database schema accordingly.
1 parent ce05c33 commit 3e42403

File tree

13 files changed

+1258
-17
lines changed

13 files changed

+1258
-17
lines changed

services/backend/api-spec.json

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5880,6 +5880,190 @@
58805880
}
58815881
}
58825882
},
5883+
"/api/teams/me/default": {
5884+
"get": {
5885+
"summary": "Get current user default team",
5886+
"tags": [
5887+
"Teams"
5888+
],
5889+
"description": "Retrieves the default team for the currently authenticated user.",
5890+
"security": [
5891+
{
5892+
"cookieAuth": []
5893+
}
5894+
],
5895+
"responses": {
5896+
"200": {
5897+
"description": "Default team retrieved successfully",
5898+
"content": {
5899+
"application/json": {
5900+
"schema": {
5901+
"type": "object",
5902+
"properties": {
5903+
"success": {
5904+
"type": "boolean",
5905+
"description": "Indicates if the operation was successful"
5906+
},
5907+
"data": {
5908+
"type": "object",
5909+
"properties": {
5910+
"id": {
5911+
"type": "string",
5912+
"description": "Team ID"
5913+
},
5914+
"name": {
5915+
"type": "string",
5916+
"description": "Team name"
5917+
},
5918+
"slug": {
5919+
"type": "string",
5920+
"description": "Team slug"
5921+
},
5922+
"description": {
5923+
"type": "string",
5924+
"nullable": true,
5925+
"description": "Team description"
5926+
},
5927+
"owner_id": {
5928+
"type": "string",
5929+
"description": "Team owner ID"
5930+
},
5931+
"is_default": {
5932+
"type": "boolean",
5933+
"description": "Indicates if this is the user's default team"
5934+
},
5935+
"created_at": {
5936+
"type": "string",
5937+
"format": "date-time",
5938+
"description": "Team creation date"
5939+
},
5940+
"updated_at": {
5941+
"type": "string",
5942+
"format": "date-time",
5943+
"description": "Team last update date"
5944+
}
5945+
},
5946+
"required": [
5947+
"id",
5948+
"name",
5949+
"slug",
5950+
"description",
5951+
"owner_id",
5952+
"is_default",
5953+
"created_at",
5954+
"updated_at"
5955+
],
5956+
"additionalProperties": false,
5957+
"description": "Team data"
5958+
},
5959+
"message": {
5960+
"type": "string",
5961+
"description": "Success message"
5962+
}
5963+
},
5964+
"required": [
5965+
"success",
5966+
"data"
5967+
],
5968+
"additionalProperties": false,
5969+
"description": "Default team retrieved successfully"
5970+
}
5971+
}
5972+
}
5973+
},
5974+
"401": {
5975+
"description": "Unauthorized - Authentication required",
5976+
"content": {
5977+
"application/json": {
5978+
"schema": {
5979+
"type": "object",
5980+
"properties": {
5981+
"success": {
5982+
"type": "boolean",
5983+
"description": "Indicates if the operation was successful (false for errors)",
5984+
"default": false
5985+
},
5986+
"error": {
5987+
"type": "string",
5988+
"description": "Error message"
5989+
},
5990+
"details": {
5991+
"type": "array",
5992+
"description": "Additional error details (validation errors)"
5993+
}
5994+
},
5995+
"required": [
5996+
"error"
5997+
],
5998+
"additionalProperties": false,
5999+
"description": "Unauthorized - Authentication required"
6000+
}
6001+
}
6002+
}
6003+
},
6004+
"404": {
6005+
"description": "Not Found - No default team found",
6006+
"content": {
6007+
"application/json": {
6008+
"schema": {
6009+
"type": "object",
6010+
"properties": {
6011+
"success": {
6012+
"type": "boolean",
6013+
"description": "Indicates if the operation was successful (false for errors)",
6014+
"default": false
6015+
},
6016+
"error": {
6017+
"type": "string",
6018+
"description": "Error message"
6019+
},
6020+
"details": {
6021+
"type": "array",
6022+
"description": "Additional error details (validation errors)"
6023+
}
6024+
},
6025+
"required": [
6026+
"error"
6027+
],
6028+
"additionalProperties": false,
6029+
"description": "Not Found - No default team found"
6030+
}
6031+
}
6032+
}
6033+
},
6034+
"500": {
6035+
"description": "Internal Server Error",
6036+
"content": {
6037+
"application/json": {
6038+
"schema": {
6039+
"type": "object",
6040+
"properties": {
6041+
"success": {
6042+
"type": "boolean",
6043+
"description": "Indicates if the operation was successful (false for errors)",
6044+
"default": false
6045+
},
6046+
"error": {
6047+
"type": "string",
6048+
"description": "Error message"
6049+
},
6050+
"details": {
6051+
"type": "array",
6052+
"description": "Additional error details (validation errors)"
6053+
}
6054+
},
6055+
"required": [
6056+
"error"
6057+
],
6058+
"additionalProperties": false,
6059+
"description": "Internal Server Error"
6060+
}
6061+
}
6062+
}
6063+
}
6064+
}
6065+
}
6066+
},
58836067
"/api/teams/me": {
58846068
"get": {
58856069
"summary": "Get current user teams",
@@ -5930,6 +6114,10 @@
59306114
"type": "string",
59316115
"description": "Team owner ID"
59326116
},
6117+
"is_default": {
6118+
"type": "boolean",
6119+
"description": "Indicates if this is the user's default team"
6120+
},
59336121
"created_at": {
59346122
"type": "string",
59356123
"format": "date-time",
@@ -5955,6 +6143,7 @@
59556143
"slug",
59566144
"description",
59576145
"owner_id",
6146+
"is_default",
59586147
"created_at",
59596148
"updated_at",
59606149
"role"
@@ -6095,6 +6284,10 @@
60956284
"type": "string",
60966285
"description": "Team owner ID"
60976286
},
6287+
"is_default": {
6288+
"type": "boolean",
6289+
"description": "Indicates if this is the user's default team"
6290+
},
60986291
"created_at": {
60996292
"type": "string",
61006293
"format": "date-time",
@@ -6112,6 +6305,7 @@
61126305
"slug",
61136306
"description",
61146307
"owner_id",
6308+
"is_default",
61156309
"created_at",
61166310
"updated_at"
61176311
],
@@ -6336,6 +6530,10 @@
63366530
"type": "string",
63376531
"description": "Team owner ID"
63386532
},
6533+
"is_default": {
6534+
"type": "boolean",
6535+
"description": "Indicates if this is the user's default team"
6536+
},
63396537
"created_at": {
63406538
"type": "string",
63416539
"format": "date-time",
@@ -6353,6 +6551,7 @@
63536551
"slug",
63546552
"description",
63556553
"owner_id",
6554+
"is_default",
63566555
"created_at",
63576556
"updated_at"
63586557
],
@@ -6798,6 +6997,10 @@
67986997
"type": "string",
67996998
"description": "Team owner ID"
68006999
},
7000+
"is_default": {
7001+
"type": "boolean",
7002+
"description": "Indicates if this is the user's default team"
7003+
},
68017004
"created_at": {
68027005
"type": "string",
68037006
"format": "date-time",
@@ -6815,6 +7018,7 @@
68157018
"slug",
68167019
"description",
68177020
"owner_id",
7021+
"is_default",
68187022
"created_at",
68197023
"updated_at"
68207024
],

0 commit comments

Comments
 (0)