Mail support
Deploy Promiscuity Auth API / deploy (push) Successful in 48s
Deploy Promiscuity Character API / deploy (push) Successful in 59s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 1m0s
Deploy Promiscuity Mail API / deploy (push) Successful in 1m9s
k8s smoke test / test (push) Successful in 9s
Deploy Promiscuity Auth API / deploy (push) Successful in 48s
Deploy Promiscuity Character API / deploy (push) Successful in 59s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 1m0s
Deploy Promiscuity Mail API / deploy (push) Successful in 1m9s
k8s smoke test / test (push) Successful in 9s
This commit is contained in:
@@ -2,6 +2,7 @@ using CharacterApi.Models;
|
||||
using CharacterApi.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MongoDB.Driver;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
@@ -47,10 +48,18 @@ public class CharactersController : ControllerBase
|
||||
LastSeenUtc = DateTime.UtcNow,
|
||||
CreatedUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
await _characters.CreateAsync(character);
|
||||
return Ok(character);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _characters.CreateAsync(character);
|
||||
}
|
||||
catch (MongoWriteException ex) when (ex.WriteError.Category == ServerErrorCategory.DuplicateKey)
|
||||
{
|
||||
return Conflict("Character name is already taken");
|
||||
}
|
||||
|
||||
return Ok(character);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Authorize(Roles = "USER,SUPER")]
|
||||
|
||||
Reference in New Issue
Block a user