This commit is contained in:
2018-09-06 22:30:17 +00:00
parent 5bb433caf3
commit 5a3a6ff4b2
3 changed files with 14 additions and 6 deletions

View File

@@ -30,6 +30,8 @@ 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
- Retag: code to tag an item should take into account if it's already tagged and not make a new record, just return existing
- Localized text
- ** DEVISE a system to ensure no unused keys are brought forward to raven

View File

@@ -125,7 +125,6 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Post TAG
///
@@ -352,6 +351,8 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
TagBiz biz = new TagBiz(ct, UserIdFromContext.Id(HttpContext.Items), 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 manull that are not mapped in EF Core
if (!biz.Delete(dbObj))
{
return BadRequest(new ApiErrorResponse(biz.Errors));

View File

@@ -32,7 +32,7 @@ namespace AyaNova.Biz
}
////////////////////////////////////////////////////////////////////////////////////////////////
//CREATE
@@ -190,7 +190,7 @@ namespace AyaNova.Biz
internal bool Delete(Tag dbObj)
{
//Determine if the object can be deleted, do the deletion tentatively
//Determine if the object can be deleted, do the deletion and related objects
ValidateCanDelete(dbObj);
if (HasErrors)
@@ -228,7 +228,7 @@ namespace AyaNova.Biz
//Can delete?
private void ValidateCanDelete(Tag inObj)
{
//whatever needs to be check to delete this object
//whatever needs to be checked to delete this object
//See if any tagmaps exist with this tag in which case it's not deleteable
if (ct.TagMap.Any(e => e.TagId == inObj.Id))
@@ -236,6 +236,11 @@ namespace AyaNova.Biz
AddError(ValidationErrorType.ReferentialIntegrity, "object", "Can't be deleted while has relations");
}
if (ct.TagGroupMap.Any(e => e.TagId == inObj.Id))
{
AddError(ValidationErrorType.ReferentialIntegrity, "TagGroup", "Can't be deleted while has TagGroup relations");
}
}
@@ -394,13 +399,13 @@ namespace AyaNova.Biz
TagMap tm = new TagMap();
tm.TagToObjectId = RavenUserId;
tm.TagToObjectType=AyaType.User;
tm.TagToObjectType = AyaType.User;
tm.TagId = RavenTagId;
tm.OwnerId = Creator;
ct.TagMap.Add(tm);
}
ct.SaveChanges();
#endregion
}
break;