This commit is contained in:
@@ -30,14 +30,13 @@ IMMEDIATE ITEMS:
|
||||
|
||||
|
||||
- Tag groups (modify tags already coded)
|
||||
- X Modify tag to bring combined list of groups with tag picklist (NOPE, let the UI query both separately and integrate them at the UI level)
|
||||
- Modify tag to remove itself from tagroupmap if deleted
|
||||
|
||||
- Tag: add test for untag everything
|
||||
- TAG: add test that can't delete if it's in a taggroup mapping
|
||||
- TAGGrOUP: add tests for all crud ops
|
||||
- TESTS: Make a test for each type of group operation from biz point of view
|
||||
- TAGMAP: code to tag an item should take into account if it's already tagged and not make a new record, just return existing
|
||||
- TAGGROUPMAP: add tagGROUPMAP should take into account if already added
|
||||
- TAGMAP: CREATEASYNC code to tag an item should take into account if it's already tagged and not make a new record, just return existing
|
||||
- TAGGROUPMAP: add tagGROUPMAP CREATEASYNC should take into account if already added //TODO: see if already present and just return inObj if so
|
||||
|
||||
- Localized text
|
||||
- ** DEVISE a system to ensure no unused keys are brought forward to raven
|
||||
|
||||
@@ -320,9 +320,9 @@ namespace AyaNova.Api.Controllers
|
||||
/// Untag all objects with this tag
|
||||
/// Required roles: BizAdminFull, DispatchFull, InventoryFull, TechFull, AccountingFull
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="id">TagId</param>
|
||||
/// <returns>Ok</returns>
|
||||
[HttpDelete("{id}")]
|
||||
[HttpPost("UntagAll/{id}")]
|
||||
public async Task<IActionResult> UnTagEverything([FromRoute] long id)
|
||||
{
|
||||
|
||||
@@ -352,9 +352,8 @@ namespace AyaNova.Api.Controllers
|
||||
//Instantiate the business object handler
|
||||
TagBiz biz = new TagBiz(ct, UserId, UserRolesFromContext.Roles(HttpContext.Items));
|
||||
|
||||
//NOTE: ct.SaveChanges not required after this call
|
||||
//Delete will look after it as it also needs to delete related records manully that are not mapped in EF Core
|
||||
if (!biz.Delete(dbObj))
|
||||
//Untag from all places
|
||||
if (!biz.Untag(dbObj))
|
||||
{
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ namespace AyaNova.Api.Controllers
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>Paged id/name collection of TagGroups with paging data</returns>
|
||||
[HttpGet("PickList", Name = nameof(PickList))]
|
||||
public async Task<IActionResult> PickList([FromQuery] string q, [FromQuery] PagingOptions pagingOptions)
|
||||
[HttpGet("TagGroupPickList", Name = nameof(TagGroupPickList))]
|
||||
public async Task<IActionResult> TagGroupPickList([FromQuery] string q, [FromQuery] PagingOptions pagingOptions)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ namespace AyaNova.Api.Controllers
|
||||
//Instantiate the business object handler
|
||||
TagGroupBiz biz = new TagGroupBiz(ct, UserIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
|
||||
|
||||
ApiPagedResponse<NameIdItem> pr = await biz.GetPickListAsync(Url, nameof(PickList), pagingOptions, q);
|
||||
ApiPagedResponse<NameIdItem> pr = await biz.GetPickListAsync(Url, nameof(TagGroupPickList), pagingOptions, q);
|
||||
return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace AyaNova.Biz
|
||||
internal async Task<TagGroupMap> CreateAsync(TagGroupMapInfo inObj)
|
||||
{
|
||||
//TODO: see if already present and just return inObj if so
|
||||
if(ct.TagGroupMap.Any().where)
|
||||
// if(ct.TagGroupMap.Any().where)
|
||||
|
||||
|
||||
Validate(inObj, true);
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace AyaNova.Util
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
||||
private const int DESIRED_SCHEMA_LEVEL = 9;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 83;
|
||||
internal const long EXPECTED_INDEX_COUNT = 16;
|
||||
internal const long EXPECTED_COLUMN_COUNT = 90;
|
||||
internal const long EXPECTED_INDEX_COUNT = 18;
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -257,6 +257,111 @@ namespace raven_integration
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test tagging a bunch of items then mass untag
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void UnTagEverythingWorks()
|
||||
{
|
||||
/*
|
||||
{
|
||||
"name": "TestTag"
|
||||
}
|
||||
*/
|
||||
|
||||
//CREATE TAG
|
||||
dynamic D = new JObject();
|
||||
D.name = Util.Uniquify("test-tag-4-untag");
|
||||
|
||||
|
||||
ApiResponse R = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TestTagId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE WIDGET 1
|
||||
dynamic D2 = new JObject();
|
||||
D2.name = Util.Uniquify("WIDGET_UNTAG_TEST1");
|
||||
D2.created = DateTime.Now.ToString();
|
||||
D2.dollarAmount = 1.11m;
|
||||
D2.active = true;
|
||||
D2.roles = 0;
|
||||
|
||||
R = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), D2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long Widget1Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
//CREATE WIDGET 2
|
||||
//D2 = new JObject();
|
||||
D2.name = Util.Uniquify("WIDGET_UNTAG_TEST2");
|
||||
D2.created = DateTime.Now.ToString();
|
||||
D2.dollarAmount = 1.11m;
|
||||
D2.active = true;
|
||||
D2.roles = 0;
|
||||
|
||||
R = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), D2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long Widget2Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
//TAGMAP to Widget 1
|
||||
/*
|
||||
{
|
||||
"tagId": 0,
|
||||
"tagToObjectId": 0,
|
||||
"tagToObjectType": 0
|
||||
}
|
||||
*/
|
||||
dynamic D3 = new JObject();
|
||||
D3.tagId = TestTagId;
|
||||
D3.tagToObjectId = Widget1Id;
|
||||
D3.tagToObjectType = 2;//widget
|
||||
|
||||
|
||||
R = await Util.PostAsync("TagMap", await Util.GetTokenAsync("BizAdminFull"), D3.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TagMap1Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
//VERIFY TAGMAP
|
||||
R = await Util.GetAsync("TagMap/" + TagMap1Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
R.ObjectResponse["result"]["id"].Value<long>().Should().Be(TagMap1Id);
|
||||
R.ObjectResponse["result"]["tagToObjectId"].Value<long>().Should().Be(Widget1Id);
|
||||
|
||||
|
||||
//TAGMAP to Widget 2
|
||||
D3.tagId = TestTagId;
|
||||
D3.tagToObjectId = Widget2Id;
|
||||
D3.tagToObjectType = 2;//widget
|
||||
|
||||
|
||||
R = await Util.PostAsync("TagMap", await Util.GetTokenAsync("BizAdminFull"), D3.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TagMap2Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
//VERIFY TAGMAP
|
||||
R = await Util.GetAsync("TagMap/" + TagMap2Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
R.ObjectResponse["result"]["id"].Value<long>().Should().Be(TagMap2Id);
|
||||
R.ObjectResponse["result"]["tagToObjectId"].Value<long>().Should().Be(Widget2Id);
|
||||
|
||||
//UNTAG-ALL
|
||||
R = await Util.PostAsync("Tag/UntagAll/" + TestTagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(R, 204);
|
||||
|
||||
|
||||
//DELETE TAG
|
||||
//This should now work because untag all freed it up
|
||||
R = await Util.DeleteAsync("Tag/" + TestTagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(R, 204);
|
||||
|
||||
//DELETE WIDGETS
|
||||
R = await Util.DeleteAsync("Widget/" + Widget1Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(R, 204);
|
||||
|
||||
R = await Util.DeleteAsync("Widget/" + Widget2Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(R, 204);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user