This commit is contained in:
@@ -30,6 +30,8 @@ IMMEDIATE ITEMS:
|
|||||||
|
|
||||||
|
|
||||||
- Tag groups (modify tags already coded)
|
- 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
|
- 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
|
- Localized text
|
||||||
- ** DEVISE a system to ensure no unused keys are brought forward to raven
|
- ** DEVISE a system to ensure no unused keys are brought forward to raven
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ namespace AyaNova.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Post TAG
|
/// Post TAG
|
||||||
///
|
///
|
||||||
@@ -352,6 +351,8 @@ namespace AyaNova.Api.Controllers
|
|||||||
//Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
TagBiz biz = new TagBiz(ct, UserIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
|
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))
|
if (!biz.Delete(dbObj))
|
||||||
{
|
{
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
internal bool Delete(Tag dbObj)
|
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);
|
ValidateCanDelete(dbObj);
|
||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
@@ -228,7 +228,7 @@ namespace AyaNova.Biz
|
|||||||
//Can delete?
|
//Can delete?
|
||||||
private void ValidateCanDelete(Tag inObj)
|
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
|
//See if any tagmaps exist with this tag in which case it's not deleteable
|
||||||
if (ct.TagMap.Any(e => e.TagId == inObj.Id))
|
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");
|
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,7 +399,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
TagMap tm = new TagMap();
|
TagMap tm = new TagMap();
|
||||||
tm.TagToObjectId = RavenUserId;
|
tm.TagToObjectId = RavenUserId;
|
||||||
tm.TagToObjectType=AyaType.User;
|
tm.TagToObjectType = AyaType.User;
|
||||||
tm.TagId = RavenTagId;
|
tm.TagId = RavenTagId;
|
||||||
tm.OwnerId = Creator;
|
tm.OwnerId = Creator;
|
||||||
ct.TagMap.Add(tm);
|
ct.TagMap.Add(tm);
|
||||||
|
|||||||
Reference in New Issue
Block a user