This commit is contained in:
2019-05-20 21:50:19 +00:00
parent 7d9f0e1424
commit 32e9650061
4 changed files with 6 additions and 25 deletions

View File

@@ -15,12 +15,12 @@ Remove OwnerId
- DONE UserOptions remove but also has a bit below - DONE UserOptions remove but also has a bit below
- DONE ValidateJsonPatch - DONE ValidateJsonPatch
- DONE FileAttachment - DONE FileAttachment
- DONE FormCustom
- Rename OwnerId to UserId for those objects that require it still - Rename OwnerId to UserId for those objects that require it still
- DataFilter - DONE DataFilter
- EventLog - EventLog
- Event object uses it see eventlog above - Event object uses it see eventlog above
- FormCustom uses it much like DataFilter does, could also be renamed to UserId and semantically be better
- UserOptions (rename to userID) - UserOptions (rename to userID)
- OpsJob (might be removable, rename it CreatorID? Or, if it's already logged in the event log then maybe no creator ID is required at all.) - OpsJob (might be removable, rename it CreatorID? Or, if it's already logged in the event log then maybe no creator ID is required at all.)

View File

@@ -59,11 +59,9 @@ namespace AyaNova.Biz
return null; return null;
else else
{ {
//do stuff with datafilter //do stuff with object
FormCustom outObj = inObj; FormCustom outObj = inObj;
outObj.OwnerId = UserId;
await ct.FormCustom.AddAsync(outObj); await ct.FormCustom.AddAsync(outObj);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
@@ -104,10 +102,7 @@ namespace AyaNova.Biz
//put //put
internal bool Put(FormCustom dbObj, FormCustom inObj) internal bool Put(FormCustom dbObj, FormCustom inObj)
{ {
//preserve the owner ID if none was specified
if (inObj.OwnerId == 0)
inObj.OwnerId = dbObj.OwnerId;
//Replace the db object with the PUT object //Replace the db object with the PUT object
CopyObject.Copy(inObj, dbObj, "Id"); CopyObject.Copy(inObj, dbObj, "Id");
//Set "original" value of concurrency token to input token //Set "original" value of concurrency token to input token
@@ -138,17 +133,6 @@ namespace AyaNova.Biz
private void Validate(FormCustom inObj, bool isNew) private void Validate(FormCustom inObj, bool isNew)
{ {
//OwnerId required
if (!isNew)
{
if (inObj.OwnerId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "OwnerId");
}
// //Owner must be current user, there are no exceptions
// if (inObj.OwnerId != UserId)
// AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "OwnerId", "OwnerId must be current user Id");
//FormKey required and must be valid //FormKey required and must be valid
if (string.IsNullOrWhiteSpace(inObj.FormKey)) if (string.IsNullOrWhiteSpace(inObj.FormKey))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "FormKey"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "FormKey");

View File

@@ -22,9 +22,6 @@ namespace AyaNova.Models
{ {
public long Id { get; set; } public long Id { get; set; }
public uint ConcurrencyToken { get; set; } public uint ConcurrencyToken { get; set; }
[Required]
public long OwnerId { get; set; }
[Required, MaxLength(255)] [Required, MaxLength(255)]
public string FormKey { get; set; }//max 255 characters ascii set public string FormKey { get; set; }//max 255 characters ascii set

View File

@@ -285,7 +285,7 @@ namespace AyaNova.Util
{ {
LogUpdateMessage(log); LogUpdateMessage(log);
exec("CREATE TABLE aformcustom (id BIGSERIAL PRIMARY KEY, ownerid bigint not null, " + exec("CREATE TABLE aformcustom (id BIGSERIAL PRIMARY KEY, " +
"formkey varchar(255) not null, template text, UNIQUE(formkey))"); "formkey varchar(255) not null, template text, UNIQUE(formkey))");
setSchemaLevel(++currentSchema); setSchemaLevel(++currentSchema);
} }