added input checks
This commit is contained in:
parent
21ff67e3a8
commit
4461884975
|
@ -8,6 +8,7 @@ using BirdsiteLive.Domain;
|
||||||
using BirdsiteLive.Domain.Enum;
|
using BirdsiteLive.Domain.Enum;
|
||||||
using BirdsiteLive.DAL.Contracts;
|
using BirdsiteLive.DAL.Contracts;
|
||||||
using BirdsiteLive.Models;
|
using BirdsiteLive.Models;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
|
|
||||||
namespace BirdsiteLive.Controllers
|
namespace BirdsiteLive.Controllers
|
||||||
{
|
{
|
||||||
|
@ -174,6 +175,11 @@ namespace BirdsiteLive.Controllers
|
||||||
[Route("/migration/move/{id}/{tweetid}/{handle}")]
|
[Route("/migration/move/{id}/{tweetid}/{handle}")]
|
||||||
public async Task<IActionResult> RemoteMigrateMove(string id, string tweetid, string handle)
|
public async Task<IActionResult> RemoteMigrateMove(string id, string tweetid, string handle)
|
||||||
{
|
{
|
||||||
|
//Check inputs
|
||||||
|
if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(tweetid) ||
|
||||||
|
string.IsNullOrWhiteSpace(handle))
|
||||||
|
return StatusCode(422);
|
||||||
|
|
||||||
//Verify can be migrated
|
//Verify can be migrated
|
||||||
var twitterAccount = await _twitterUserDal.GetTwitterUserAsync(id);
|
var twitterAccount = await _twitterUserDal.GetTwitterUserAsync(id);
|
||||||
if (twitterAccount != null && (twitterAccount.Deleted
|
if (twitterAccount != null && (twitterAccount.Deleted
|
||||||
|
@ -198,6 +204,10 @@ namespace BirdsiteLive.Controllers
|
||||||
[Route("/migration/delete/{id}/{tweetid}")]
|
[Route("/migration/delete/{id}/{tweetid}")]
|
||||||
public async Task<IActionResult> RemoteMigrateDelete(string id, string tweetid)
|
public async Task<IActionResult> RemoteMigrateDelete(string id, string tweetid)
|
||||||
{
|
{
|
||||||
|
//Check inputs
|
||||||
|
if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(tweetid))
|
||||||
|
return StatusCode(422);
|
||||||
|
|
||||||
//Verify can be deleted
|
//Verify can be deleted
|
||||||
var twitterAccount = await _twitterUserDal.GetTwitterUserAsync(id);
|
var twitterAccount = await _twitterUserDal.GetTwitterUserAsync(id);
|
||||||
if (twitterAccount != null && twitterAccount.Deleted) return Ok();
|
if (twitterAccount != null && twitterAccount.Deleted) return Ok();
|
||||||
|
|
Loading…
Reference in New Issue