コード例 #1
0
        public async Task <ActionResult <DogMatches> > GetMatches(int id)
        {
            string requestUserId = GetUserId();
            string ownerId       = await _userService.GetOwnerIdByDogId(id);

            if (requestUserId == ownerId)
            {
                return(Ok(
                           await _matchesService.GetDogMatchesByDogId(id, ownerId)
                           ));
            }
            else
            {
                _logger.LogWarning($"Request user ({requestUserId}) does not have the permission (non-owner) to get dog matches for dog Id: {id}");
                return(Unauthorized());
            }
        }