Closed arkadiusz-wieczorek closed 9 years ago
Ok, I've made some changes to the FileManager. Does the error still occur in 0.5.2?
At now there is other error. Maybe I have mistakes in main.js
zbox@zbox-ZBOX-ID83:~/Projects/Placetag/placetag-app$ sudo node .
10:03:00.557 - info: Detected plugin sealious-www-server
/home/zbox/Projects/Placetag/placetag-app/node_modules/sealious/lib/chip-types/resource-type.js:11
throw new Sealious.Errors.DeveloperError("Tried to create a resource-type wi
^
Error: Tried to create a resource-type without a declaration
at new SealiousErrors.Error (/home/zbox/Projects/Placetag/placetag-app/node_modules/sealious/lib/response/error.js:6:12)
at new SealiousErrors.DeveloperError (/home/zbox/Projects/Placetag/placetag-app/node_modules/sealious/lib/response/error.js:85:12)
at ResourceType (/home/zbox/Projects/Placetag/placetag-app/node_modules/sealious/lib/chip-types/resource-type.js:11:9)
at Object.<anonymous> (/home/zbox/Projects/Placetag/placetag-app/main.js:10:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
That's because the ResourceType API changed a little bit in 0.5.0. You chould change all your resource type declratations from
new Sealious.ChipTypes.ResourceType("type_name", {/*rest of the declaration*/})
to
new Sealious.ChipTypes.ResourceType({name: "type_name", /* rest of the declaration*/})
In your application's code.
Ok, I changed this, at now I can't send POST/PATCH, only DELETE works.
10:18:03.665 - error: POST /api/v1/places
from: 127.0.0.1, mime: multipart/form-data
result: failed - There are problems with some of the provided values
Error: There are problems with some of the provided values
at new SealiousErrors.Error (/home/zbox/Projects/Placetag/placetag-app/node_modules/sealious/lib/response/error.js:6:12)
at new SealiousErrors.ValidationError (/home/zbox/Projects/Placetag/placetag-app/node_modules/sealious/lib/response/error.js:21:12)
at null.<anonymous> (/home/zbox/Projects/Placetag/placetag-app/node_modules/sealious/lib/chip-types/resource-type.js:136:11)
at bound (domain.js:254:14)
at runBound (domain.js:267:12)
at tryCatcher (/home/zbox/Projects/Placetag/placetag-app/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (/home/zbox/Projects/Placetag/placetag-app/node_modules/bluebird/js/main/promise.js:503:31)
at Promise._settlePromiseAt (/home/zbox/Projects/Placetag/placetag-app/node_modules/bluebird/js/main/promise.js:577:18)
at Promise._settlePromises (/home/zbox/Projects/Placetag/placetag-app/node_modules/bluebird/js/main/promise.js:693:14)
at Async._drainQueue (/home/zbox/Projects/Placetag/placetag-app/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/home/zbox/Projects/Placetag/placetag-app/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/zbox/Projects/Placetag/placetag-app/node_modules/bluebird/js/main/async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:367:17)
My structure rest of the declaration
var places = new Sealious.ChipTypes.ResourceType({name: "places",
fields:[
{name: "name", type: "text"},
{name: "address", type: "text"},
{name: "city", type: "text"},
{name: "country", type: "text"},
{name: "category", type: "category"},
{name: "subcategory", type: "subcategory"},
{name: "description", type: "text"},
{name: "votes", type: "int"},
{name: "sum", type: "int"},
{name: "globalRate", type: "int"},
{name: "myRate", type: "int"},
{name: "longitude", type: "float", required: true}, //52 dlugosc
{name: "latitude", type: "float", required: true}, //16 szerokosc
//files
{name: "image", type: "file", params: {no_file_value: "/img/places/default.jpg"}},
{name: "image_name", type: "text"},
//to compare
{name: "owner_id", type: "text"}
],
access_strategy: "public"
});
Could you post the HTTP API response for a POST request?
I'm surprised
Oh, that's right, it's caused by another API change in the 0.5.0 beta - field-type's isProperValue
method takes context
as it's first argument, and new_value
as second, so probably just changing
my_field_type.prototype.isProperValue = function(new_value){//...
to
my_field_type.prototype.isProperValue = function(context, new_value){//...
should help.
If in doubt, see field-type api reference :)
Thanks, everything works. I close issue :)
As you can see save_file function doesn't have reference to
Sealious
object. Addingvar Sealious = require("sealious");
infile-manager.js
solves problem, but this very ugly solution. We should rewrite save_file function, infile-manager.js
we need to add reference toDispatcher
.