This commit is contained in:
@@ -353,7 +353,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Delete TagGroup
|
||||
/// Delete TagGroup - Does not delete tags from objects or tags themselves, only the group
|
||||
/// Required roles: BizAdminFull, DispatchFull, InventoryFull, TechFull, AccountingFull
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
@@ -408,9 +408,9 @@ namespace AyaNova.Api.Controllers
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="inObj">TagMapGroupInfo</param>
|
||||
/// <returns><see cref="TagMap"/> object</returns>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PostTagMap([FromBody] TagMapGroupInfo inObj)
|
||||
/// <returns>A list of names and id's of tags that were applied to object</returns>
|
||||
[HttpPost("TagObject")]
|
||||
public async Task<IActionResult> TagObject([FromBody] TagMapGroupInfo inObj)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
{
|
||||
|
||||
@@ -53,22 +53,70 @@ namespace raven_integration
|
||||
//ADD TEST TAGS TO GROUP
|
||||
D = new JObject();
|
||||
D.tagId = TestTag1Id;
|
||||
D.tagGroupId= TestTagGroupId;
|
||||
D.tagGroupId = TestTagGroupId;
|
||||
R = await Util.PostAsync("TagGroupMap", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
|
||||
D.tagId = TestTag2Id;
|
||||
D.tagGroupId= TestTagGroupId;
|
||||
D.tagGroupId = TestTagGroupId;
|
||||
R = await Util.PostAsync("TagGroupMap", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
|
||||
|
||||
|
||||
//GET PICKLIST OF TAGS FOR GROUP
|
||||
R = await Util.GetAsync("TagGroup/TagsInGroupPickList/" + TestTagGroupId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
R = await Util.GetAsync("TagGroup/TagsInGroupPickList/" + TestTagGroupId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
// R.ObjectResponse["result"]["id"].Value<long>().Should().Be(tagMapId);
|
||||
// R.ObjectResponse["result"]["id"].Value<long>().Should().Be(tagMapId);
|
||||
|
||||
|
||||
//TAG ITEM WITH GROUP OF TAGS
|
||||
//CREATE WIDGET
|
||||
D = new JObject();
|
||||
D.name = Util.Uniquify("WIDGET_TAG_GROUP_TAG_TEST");
|
||||
D.created = DateTime.Now.ToString();
|
||||
D.dollarAmount = 1.11m;
|
||||
D.active = true;
|
||||
D.roles = 0;
|
||||
|
||||
R = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long WidgetId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
|
||||
|
||||
//CREATE TAGMAP (tag the widget)
|
||||
/*
|
||||
{
|
||||
"tagGroupId": 0,
|
||||
"tagToObjectId": 0,
|
||||
"tagToObjectType": 0
|
||||
}
|
||||
*/
|
||||
D = new JObject();
|
||||
D.tagGroupId = TestTagGroupId;
|
||||
D.tagToObjectId = WidgetId;
|
||||
D.tagToObjectType = 2;//widget
|
||||
|
||||
|
||||
R = await Util.PostAsync("TagGroup/TagObject", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
((JArray)R.ObjectResponse["result"]).Count.Should().Be(2);
|
||||
|
||||
|
||||
//VALIDATE HAS TAGS FROM GROUP
|
||||
D = new JObject();
|
||||
D.objectId = WidgetId;
|
||||
D.objectType = 2;//widget
|
||||
R = await Util.GetAsync("TagMap/TagsOnObject/", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
Util.ValidateHTTPStatusCode(R, 200);
|
||||
//there should be 2 of them
|
||||
((JArray)R.ObjectResponse["result"]).Count.Should().Be(2);
|
||||
|
||||
|
||||
//DELETE TAG-GROUP
|
||||
R = await Util.DeleteAsync("TagGroup/" + TestTagGroupId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(R, 204);
|
||||
|
||||
//UNTAG ALL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user