TeamsController

@RestController
@RequestMapping(value = "BASE_EQUINOX_ENDPOINT + USERS_KEY + "/{" + USER_IDENTIFIER_KEY + "}/" + TEAMS_KEY")
open class TeamsController : DefaultRefyController<I>

The TeamsController class is useful to manage all the Team operations

Author

N7ghtm4r3 - Tecknobit

See also

EquinoxController

Constructors

Link copied to clipboard
@Autowired
protected constructor(linksService: LinksService, linksCollectionsService: LinksCollectionsService, teamsService: TeamsService, refyUsersService: RefyUsersService)
Constructor used to init the controller

Properties

Link copied to clipboard
protected val configuration: EquinoxBackendConfiguration
Link copied to clipboard
protected open var jsonHelper: JsonHelper
Link copied to clipboard
linksCollectionsService helper to manage the LinksCollection database operations
Link copied to clipboard
protected val linksService: LinksService
linksService helper to manage the RefyLink database operations
Link copied to clipboard
protected open var me: T
Link copied to clipboard
protected open var messageSource: MessageSource
Link copied to clipboard
refyUsersService helper to manage the RefyUser database operations
Link copied to clipboard
open var resourcesProvider: ResourcesProvider
Link copied to clipboard
val RESPONSE_SUCCESSFUL_MESSAGE: String = "operation_executed_successfully"
Link copied to clipboard
protected open var serverProtector: ServerProtector
Link copied to clipboard
protected val teamsService: TeamsService
teamsService helper to manage the Team database operations
Link copied to clipboard
protected open var userItem: I
userItem the current item requested by the user
Link copied to clipboard
protected open var usersRepository: R
Link copied to clipboard
val WRONG_EMAIL_MESSAGE: String = "wrong_email"
Link copied to clipboard
val WRONG_LANGUAGE_MESSAGE: String = "wrong_language"
Link copied to clipboard
val WRONG_NAME_MESSAGE: String = "wrong_name"
Link copied to clipboard
val WRONG_PASSWORD_MESSAGE: String = "wrong_password"
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure"
Link copied to clipboard
val WRONG_SURNAME_MESSAGE: String = "wrong_surname"

Functions

Link copied to clipboard
@PatchMapping(headers = "token", path = ""/{" + TEAM_IDENTIFIER_KEY + "}/" + MEMBERS_KEY + "/{" + MEMBER_IDENTIFIER_KEY + "}" + CHANGE_MEMBER_ROLE_ENDPOINT")
open fun changeMemberRole(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @PathVariable(value = "member_id") memberId: String, @RequestBody payload: Map<String, Any>): String
Method to change the role of a member
Link copied to clipboard
@PostMapping(headers = "token")
open fun create(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @ModelAttribute payload: TeamsService.TeamPayload): String
Method to create a new team
open fun create(token: String, userId: String, payload: Map<String, Any>): String
Method to create a new item
Link copied to clipboard
@DeleteMapping(headers = "token", path = "/{" + TEAM_IDENTIFIER_KEY + "}")
open fun delete(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String): String
Method to delete a team
Link copied to clipboard
@PostMapping(headers = "token", path = "/{" + TEAM_IDENTIFIER_KEY + "}")
open fun edit(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @ModelAttribute payload: TeamsService.TeamPayload): String
Method to edit a team
open fun edit(token: String, userId: String, itemId: String, payload: Map<String, Any>): String
Method to edit an existing item
Link copied to clipboard
protected open fun failedResponse(errorKey: String): String
Link copied to clipboard
Link copied to clipboard
protected open fun getInternationalizedMessage(messageKey: String): String
Link copied to clipboard
@GetMapping(headers = "token", path = "/{" + TEAM_IDENTIFIER_KEY + "}")
open fun <T> getItem(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String): T
Method to get a team
Link copied to clipboard
@GetMapping(headers = "token", path = ""/{" + TEAM_IDENTIFIER_KEY + "}/" + COLLECTIONS_KEY")
open fun <T> getTeamCollections(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @RequestParam(name = "page", defaultValue = "0", required = false) page: Int, @RequestParam(name = "pageSize", defaultValue = "10", required = false) pageSize: Int): T
Method to get the list of the collections of a team
Link copied to clipboard
@GetMapping(headers = "token", path = ""/{" + TEAM_IDENTIFIER_KEY + "}/" + LINKS_KEY")
open fun <T> getTeamLinks(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @RequestParam(name = "page", defaultValue = "0", required = false) page: Int, @RequestParam(name = "pageSize", defaultValue = "10", required = false) pageSize: Int, @RequestParam(name = "keywords", defaultValue = "", required = false) keywords: Set<String>): T
Method to get the list of the links of a team
Link copied to clipboard
private open fun hierarchyIsNotRespected(userId: String, memberId: String): Boolean
Method to check whether the hierarchy of the members is respected in the request
Link copied to clipboard
open fun initEquinoxEnvironment(context: Class<out Any>, args: Array<String>)
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Link copied to clipboard
protected open fun isUserNotAuthorized(userId: String, token: String, teamId: String): Boolean
Method to get whether the user is or not authorized to operate with the team requested
Link copied to clipboard
@DeleteMapping(headers = "token", path = ""/{" + TEAM_IDENTIFIER_KEY + "}" + LEAVE_ENDPOINT")
open fun leave(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String): String
Method to leave from a team
Link copied to clipboard
@GetMapping(headers = "token")
open fun <T> list(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @RequestParam(name = "owned_only") ownedOnly: Boolean, @RequestParam(name = "page", defaultValue = "0", required = false) page: Int, @RequestParam(name = "pageSize", defaultValue = "10", required = false) pageSize: Int, @RequestParam(name = "keywords", defaultValue = "", required = false) keywords: Set<String>): T
Method to get a list of teams
Link copied to clipboard
@GetMapping(headers = "token", path = ""/" + MEMBERS_KEY")
open fun <T> listPotentialMembers(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @RequestParam(name = "page", defaultValue = "0", required = false) page: Int, @RequestParam(name = "pageSize", defaultValue = "10", required = false) pageSize: Int): T
Method to get the potential members to add in a team
Link copied to clipboard
protected open fun loadJsonHelper(payload: JSONObject)
Link copied to clipboard
Link copied to clipboard
protected open fun plainResponse(status: ResponseStatus, message: String): String
Link copied to clipboard
@DeleteMapping(headers = "token", path = "/{" + TEAM_IDENTIFIER_KEY + "}/" + COLLECTIONS_KEY + "/{" + COLLECTION_IDENTIFIER_KEY + "}")
open fun removeCollectionFromTeam(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @PathVariable(value = "collection_id") collectionId: String): String
Method to remove a collection from a team
Link copied to clipboard
@DeleteMapping(headers = "token", path = "/{" + TEAM_IDENTIFIER_KEY + "}/" + LINKS_KEY + "/{" + LINK_IDENTIFIER_KEY + "}")
open fun removeLinkFromTeam(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @PathVariable(value = "link_id") linkId: String): String
Method to remove a link from a team
Link copied to clipboard
@DeleteMapping(headers = "token", path = "/{" + TEAM_IDENTIFIER_KEY + "}/" + MEMBERS_KEY + "/{" + MEMBER_IDENTIFIER_KEY + "}")
open fun removeMember(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @PathVariable(value = "member_id") memberId: String): String
Method to remove a member from a team
Link copied to clipboard
protected open fun setSessionLocale(locale: String)
Link copied to clipboard
@PutMapping(headers = "token", path = ""/{" + TEAM_IDENTIFIER_KEY + "}/" + COLLECTIONS_KEY")
open fun shareCollectionsWithTeam(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @RequestBody payload: Map<String, Any>): String
Method to share the collections with the team
Link copied to clipboard
@PutMapping(headers = "token", path = ""/{" + TEAM_IDENTIFIER_KEY + "}/" + LINKS_KEY")
open fun shareLinksWithTeam(@RequestHeader(value = "token") token: String, @PathVariable(value = "user_id") userId: String, @PathVariable(value = "team_id") teamId: String, @RequestBody payload: Map<String, Any>): String
Method to share the links with the team
Link copied to clipboard
protected open fun successResponse(): String
protected open fun <V> successResponse(value: V): HashMap<String, V>
Link copied to clipboard
protected open fun userIsNotTheItemOwner(userId: String, token: String, itemId: String): Boolean
Method to get whether the user is or not the owner of the item requested
Link copied to clipboard
protected open fun wrongProcedureResponse(): String