Skip to content

Commit bc403a3

Browse files
committed
feat: implement team management features with API integration
- Add unit tests for teams route in backend to ensure proper functionality and error handling. - Create AddTeamModal component for adding new teams with validation and error handling. - Update i18n localization for team-related messages and errors. - Develop Teams view to display user teams with sorting, filtering, and pagination capabilities. - Implement columns for team data display including name, description, role, and creation date. - Define TypeScript interfaces for API responses and team data structure.
1 parent 8725ee5 commit bc403a3

File tree

25 files changed

+3744
-1169
lines changed

25 files changed

+3744
-1169
lines changed

package-lock.json

Lines changed: 1001 additions & 1147 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/backend/api-spec.json

Lines changed: 393 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5880,6 +5880,399 @@
58805880
}
58815881
}
58825882
},
5883+
"/api/teams": {
5884+
"post": {
5885+
"summary": "Create new team",
5886+
"tags": [
5887+
"Teams"
5888+
],
5889+
"description": "Creates a new team with the specified name and description. Users can create up to 3 teams maximum. The slug is automatically generated from the team name and made unique.",
5890+
"requestBody": {
5891+
"content": {
5892+
"application/json": {
5893+
"schema": {
5894+
"type": "object",
5895+
"properties": {
5896+
"name": {
5897+
"type": "string",
5898+
"minLength": 1,
5899+
"maxLength": 100,
5900+
"description": "Team name"
5901+
},
5902+
"description": {
5903+
"type": "string",
5904+
"maxLength": 500,
5905+
"description": "Team description"
5906+
}
5907+
},
5908+
"required": [
5909+
"name"
5910+
],
5911+
"additionalProperties": false
5912+
}
5913+
}
5914+
},
5915+
"required": true
5916+
},
5917+
"security": [
5918+
{
5919+
"cookieAuth": []
5920+
}
5921+
],
5922+
"responses": {
5923+
"201": {
5924+
"description": "Team created successfully",
5925+
"content": {
5926+
"application/json": {
5927+
"schema": {
5928+
"type": "object",
5929+
"properties": {
5930+
"success": {
5931+
"type": "boolean",
5932+
"description": "Indicates if the operation was successful"
5933+
},
5934+
"data": {
5935+
"type": "object",
5936+
"properties": {
5937+
"id": {
5938+
"type": "string",
5939+
"description": "Team ID"
5940+
},
5941+
"name": {
5942+
"type": "string",
5943+
"description": "Team name"
5944+
},
5945+
"slug": {
5946+
"type": "string",
5947+
"description": "Team slug"
5948+
},
5949+
"description": {
5950+
"type": "string",
5951+
"nullable": true,
5952+
"description": "Team description"
5953+
},
5954+
"owner_id": {
5955+
"type": "string",
5956+
"description": "Team owner ID"
5957+
},
5958+
"created_at": {
5959+
"type": "string",
5960+
"format": "date-time",
5961+
"description": "Team creation date"
5962+
},
5963+
"updated_at": {
5964+
"type": "string",
5965+
"format": "date-time",
5966+
"description": "Team last update date"
5967+
}
5968+
},
5969+
"required": [
5970+
"id",
5971+
"name",
5972+
"slug",
5973+
"description",
5974+
"owner_id",
5975+
"created_at",
5976+
"updated_at"
5977+
],
5978+
"additionalProperties": false,
5979+
"description": "Team data"
5980+
},
5981+
"message": {
5982+
"type": "string",
5983+
"description": "Success message"
5984+
}
5985+
},
5986+
"required": [
5987+
"success",
5988+
"data"
5989+
],
5990+
"additionalProperties": false,
5991+
"description": "Team created successfully"
5992+
}
5993+
}
5994+
}
5995+
},
5996+
"400": {
5997+
"description": "Bad Request - Validation error or team limit reached",
5998+
"content": {
5999+
"application/json": {
6000+
"schema": {
6001+
"type": "object",
6002+
"properties": {
6003+
"success": {
6004+
"type": "boolean",
6005+
"description": "Indicates if the operation was successful (false for errors)",
6006+
"default": false
6007+
},
6008+
"error": {
6009+
"type": "string",
6010+
"description": "Error message"
6011+
},
6012+
"details": {
6013+
"type": "array",
6014+
"description": "Additional error details (validation errors)"
6015+
}
6016+
},
6017+
"required": [
6018+
"error"
6019+
],
6020+
"additionalProperties": false,
6021+
"description": "Bad Request - Validation error or team limit reached"
6022+
}
6023+
}
6024+
}
6025+
},
6026+
"401": {
6027+
"description": "Unauthorized - Authentication required",
6028+
"content": {
6029+
"application/json": {
6030+
"schema": {
6031+
"type": "object",
6032+
"properties": {
6033+
"success": {
6034+
"type": "boolean",
6035+
"description": "Indicates if the operation was successful (false for errors)",
6036+
"default": false
6037+
},
6038+
"error": {
6039+
"type": "string",
6040+
"description": "Error message"
6041+
},
6042+
"details": {
6043+
"type": "array",
6044+
"description": "Additional error details (validation errors)"
6045+
}
6046+
},
6047+
"required": [
6048+
"error"
6049+
],
6050+
"additionalProperties": false,
6051+
"description": "Unauthorized - Authentication required"
6052+
}
6053+
}
6054+
}
6055+
},
6056+
"403": {
6057+
"description": "Forbidden - Insufficient permissions",
6058+
"content": {
6059+
"application/json": {
6060+
"schema": {
6061+
"type": "object",
6062+
"properties": {
6063+
"success": {
6064+
"type": "boolean",
6065+
"description": "Indicates if the operation was successful (false for errors)",
6066+
"default": false
6067+
},
6068+
"error": {
6069+
"type": "string",
6070+
"description": "Error message"
6071+
},
6072+
"details": {
6073+
"type": "array",
6074+
"description": "Additional error details (validation errors)"
6075+
}
6076+
},
6077+
"required": [
6078+
"error"
6079+
],
6080+
"additionalProperties": false,
6081+
"description": "Forbidden - Insufficient permissions"
6082+
}
6083+
}
6084+
}
6085+
},
6086+
"500": {
6087+
"description": "Internal Server Error",
6088+
"content": {
6089+
"application/json": {
6090+
"schema": {
6091+
"type": "object",
6092+
"properties": {
6093+
"success": {
6094+
"type": "boolean",
6095+
"description": "Indicates if the operation was successful (false for errors)",
6096+
"default": false
6097+
},
6098+
"error": {
6099+
"type": "string",
6100+
"description": "Error message"
6101+
},
6102+
"details": {
6103+
"type": "array",
6104+
"description": "Additional error details (validation errors)"
6105+
}
6106+
},
6107+
"required": [
6108+
"error"
6109+
],
6110+
"additionalProperties": false,
6111+
"description": "Internal Server Error"
6112+
}
6113+
}
6114+
}
6115+
}
6116+
}
6117+
}
6118+
},
6119+
"/api/teams/me": {
6120+
"get": {
6121+
"summary": "Get current user teams",
6122+
"tags": [
6123+
"Teams"
6124+
],
6125+
"description": "Retrieves all teams that the currently authenticated user belongs to, including their role in each team.",
6126+
"security": [
6127+
{
6128+
"cookieAuth": []
6129+
}
6130+
],
6131+
"responses": {
6132+
"200": {
6133+
"description": "User teams retrieved successfully",
6134+
"content": {
6135+
"application/json": {
6136+
"schema": {
6137+
"type": "object",
6138+
"properties": {
6139+
"success": {
6140+
"type": "boolean",
6141+
"description": "Indicates if the operation was successful"
6142+
},
6143+
"data": {
6144+
"type": "array",
6145+
"items": {
6146+
"type": "object",
6147+
"properties": {
6148+
"id": {
6149+
"type": "string",
6150+
"description": "Team ID"
6151+
},
6152+
"name": {
6153+
"type": "string",
6154+
"description": "Team name"
6155+
},
6156+
"slug": {
6157+
"type": "string",
6158+
"description": "Team slug"
6159+
},
6160+
"description": {
6161+
"type": "string",
6162+
"nullable": true,
6163+
"description": "Team description"
6164+
},
6165+
"owner_id": {
6166+
"type": "string",
6167+
"description": "Team owner ID"
6168+
},
6169+
"created_at": {
6170+
"type": "string",
6171+
"format": "date-time",
6172+
"description": "Team creation date"
6173+
},
6174+
"updated_at": {
6175+
"type": "string",
6176+
"format": "date-time",
6177+
"description": "Team last update date"
6178+
},
6179+
"role": {
6180+
"type": "string",
6181+
"enum": [
6182+
"team_admin",
6183+
"team_user"
6184+
],
6185+
"description": "User role in the team"
6186+
}
6187+
},
6188+
"required": [
6189+
"id",
6190+
"name",
6191+
"slug",
6192+
"description",
6193+
"owner_id",
6194+
"created_at",
6195+
"updated_at",
6196+
"role"
6197+
],
6198+
"additionalProperties": false
6199+
},
6200+
"description": "Array of teams with user roles"
6201+
}
6202+
},
6203+
"required": [
6204+
"success",
6205+
"data"
6206+
],
6207+
"additionalProperties": false,
6208+
"description": "User teams retrieved successfully"
6209+
}
6210+
}
6211+
}
6212+
},
6213+
"401": {
6214+
"description": "Unauthorized - Authentication required",
6215+
"content": {
6216+
"application/json": {
6217+
"schema": {
6218+
"type": "object",
6219+
"properties": {
6220+
"success": {
6221+
"type": "boolean",
6222+
"description": "Indicates if the operation was successful (false for errors)",
6223+
"default": false
6224+
},
6225+
"error": {
6226+
"type": "string",
6227+
"description": "Error message"
6228+
},
6229+
"details": {
6230+
"type": "array",
6231+
"description": "Additional error details (validation errors)"
6232+
}
6233+
},
6234+
"required": [
6235+
"error"
6236+
],
6237+
"additionalProperties": false,
6238+
"description": "Unauthorized - Authentication required"
6239+
}
6240+
}
6241+
}
6242+
},
6243+
"500": {
6244+
"description": "Internal Server Error",
6245+
"content": {
6246+
"application/json": {
6247+
"schema": {
6248+
"type": "object",
6249+
"properties": {
6250+
"success": {
6251+
"type": "boolean",
6252+
"description": "Indicates if the operation was successful (false for errors)",
6253+
"default": false
6254+
},
6255+
"error": {
6256+
"type": "string",
6257+
"description": "Error message"
6258+
},
6259+
"details": {
6260+
"type": "array",
6261+
"description": "Additional error details (validation errors)"
6262+
}
6263+
},
6264+
"required": [
6265+
"error"
6266+
],
6267+
"additionalProperties": false,
6268+
"description": "Internal Server Error"
6269+
}
6270+
}
6271+
}
6272+
}
6273+
}
6274+
}
6275+
},
58836276
"/api/auth/email/register": {
58846277
"post": {
58856278
"summary": "User registration via email",

0 commit comments

Comments
 (0)