This commit is contained in:
@@ -159,6 +159,13 @@ namespace AyaNova.Api.Controllers
|
|||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
|
||||||
|
//Default filters can never be created from outside
|
||||||
|
//they are only ever created from inside so a post with a default=true is always invalid
|
||||||
|
if (inObj.Default == true)
|
||||||
|
{
|
||||||
|
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, "default", "Default filters can only be created internally"));
|
||||||
|
}
|
||||||
|
|
||||||
//Create and validate
|
//Create and validate
|
||||||
DataListSavedFilter o = await biz.CreateAsync(inObj);
|
DataListSavedFilter o = await biz.CreateAsync(inObj);
|
||||||
if (o == null)
|
if (o == null)
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ namespace AyaNova.Models
|
|||||||
public string Name { get; set; }//max 255 characters ascii set
|
public string Name { get; set; }//max 255 characters ascii set
|
||||||
[Required]
|
[Required]
|
||||||
public bool Public { get; set; }
|
public bool Public { get; set; }
|
||||||
|
[Required]
|
||||||
|
public bool Default { get; set; } //is the users default filter for this listkey
|
||||||
[Required, MaxLength(255)]
|
[Required, MaxLength(255)]
|
||||||
public string ListKey { get; set; }//max 255 characters ascii set
|
public string ListKey { get; set; }//max 255 characters ascii set
|
||||||
public string Filter { get; set; }//JSON filter object representing DataListFilterOption
|
public string Filter { get; set; }//JSON serialized List<DataListFilterOption> object of DataListBase
|
||||||
//filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}]
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -504,13 +504,13 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
//DATAFILTER / DATALISTTEMPLATE tables
|
//DATALISTSAVEDFILTER
|
||||||
if (currentSchema < 7)
|
if (currentSchema < 7)
|
||||||
{
|
{
|
||||||
LogUpdateMessage(log);
|
LogUpdateMessage(log);
|
||||||
|
|
||||||
await ExecQueryAsync("CREATE TABLE adatalistsavedfilter (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL, name TEXT NOT NULL UNIQUE, public BOOL NOT NULL," +
|
await ExecQueryAsync("CREATE TABLE adatalistsavedfilter (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL, name TEXT NOT NULL, public BOOL NOT NULL, " +
|
||||||
"listkey VARCHAR(255) NOT NULL, filter TEXT)");
|
"default BOOL NOT NULL, listkey VARCHAR(255) NOT NULL, filter TEXT)");
|
||||||
|
|
||||||
await SetSchemaLevelAsync(++currentSchema);
|
await SetSchemaLevelAsync(++currentSchema);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user