示例#1
0
        public async Task <IActionResult> RunAsync(
            [HttpTrigger(AuthorizationLevel.Function, "delete", Route = "OptOut/{userUuid}")] HttpRequest req,
            string userUuid)
        {
            Logger.LogInformation($"{nameof(OptOutApi)} processed a request.");

            var user = new UserParameter()
            {
                UserUuid = userUuid
            };

            // validation
            var validationResult = await Validation.ValidateAsync(req, user);

            if (!validationResult.IsValid)
            {
                AddBadRequest(req);
                return(validationResult.ErrorActionResult);
            }

            // delete tek
            await DiagnosisRepository.DeleteAsync(user);

            // NOTE:consider privacy: delete published Tek at after 14 days.

            // delete user
            await UserRepository.Delete(user);

            return(new NoContentResult());
        }