Skip to content
Snippets Groups Projects

Product/1027 apiClientGenerator

Merged Petar Hristov requested to merge Product/1027-apiClientGenerator into Sprint/2021-18
6 files
+ 38
19
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -6,8 +6,8 @@ using Coscine.Database.Models;
using Coscine.Database.ReturnObjects;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Coscine.Api.User.Controllers
@@ -37,13 +37,13 @@ namespace Coscine.Api.User.Controllers
/// <summary>
/// This method enables the user to request a change of his or her contact email. After entering a valid email, a confirmation email will be sent to the new address and a notification email will be sent to the present address.
/// </summary>
/// <param name="email">A new email as string set by the user.</param>
/// <param name="emailAddress">A new email as string set by the user.</param>
/// <returns>Output ContactChangeObject. </returns>
/// <response code="200">If no pending emails exist. Emails will be sent out. </response>
/// <response code="202">If there is already a pending email change. In this case the old entry or entries will be deleted, which will directly invalidate all previous tokens. </response>
/// <response code="422">If the email is null or not a valid email format. </response>
[HttpPost("[controller]/emailchange")]
public IActionResult ChangeContactEmail([FromBody] string emailAddress)
public ActionResult<ContactChangeObject> ChangeContactEmail([FromBody] string emailAddress)
{
var user = _authenticator.GetUser();
if (emailAddress != null && new EmailAddressAttribute().IsValid(emailAddress))
@@ -86,7 +86,7 @@ namespace Coscine.Api.User.Controllers
/// <response code="404">If Token and User ID combinations invalid. </response>
[AllowAnonymous]
[HttpGet("[controller]/confirm/{verification}")]
public IActionResult ConfirmContactEmail(string verification)
public ActionResult<UserObject> ConfirmContactEmail(string verification)
{
Guid token = Guid.Parse(verification);
try
@@ -118,7 +118,7 @@ namespace Coscine.Api.User.Controllers
/// <response code="200">If there is already a pending email change. </response>
/// <response code="204">If there is no pending email change (database empty). </response>
[HttpGet("[controller]/status")]
public IActionResult ConfirmationStatus()
public ActionResult<IEnumerable<ContactChangeObject>> ConfirmationStatus()
{
var user = _authenticator.GetUser();
if (_contactChangeModel.UserHasEmailsToConfirm(user.Id))
Loading