This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user