added input checks

This commit is contained in:
Nicolas Constant 2022-12-28 18:29:57 -05:00
parent 21ff67e3a8
commit 4461884975
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,7 @@ using BirdsiteLive.Domain;
using BirdsiteLive.Domain.Enum;
using BirdsiteLive.DAL.Contracts;
using BirdsiteLive.Models;
using System.Reflection.Metadata;
namespace BirdsiteLive.Controllers
{
@ -174,6 +175,11 @@ namespace BirdsiteLive.Controllers
[Route("/migration/move/{id}/{tweetid}/{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
var twitterAccount = await _twitterUserDal.GetTwitterUserAsync(id);
if (twitterAccount != null && (twitterAccount.Deleted
@ -198,6 +204,10 @@ namespace BirdsiteLive.Controllers
[Route("/migration/delete/{id}/{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
var twitterAccount = await _twitterUserDal.GetTwitterUserAsync(id);
if (twitterAccount != null && twitterAccount.Deleted) return Ok();