removed from Item: update() and save() methods which take the 'url_was_changed' argument
and added ItemModelData (based on morm::ModelData) class which has 'prepare_unique_url' field, an object of this class is passed to update(), insert() and save() methods fixed: Dirs::CheckRootDir(): update should update childs too (privileges) WIP: #4
This commit is contained in:
@@ -50,20 +50,31 @@ public:
|
||||
|
||||
long size;
|
||||
|
||||
/*
|
||||
* add an id of an item and compare it in 'update' method
|
||||
* (in a case size==1)
|
||||
*
|
||||
*/
|
||||
long item_id;
|
||||
|
||||
void map_fields()
|
||||
{
|
||||
field(L"size", size);
|
||||
field(L"item_id", item_id);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// IMPROVEME rename me and move to a better place
|
||||
class ItemModelData : public morm::ModelData
|
||||
{
|
||||
public:
|
||||
|
||||
ItemModelData()
|
||||
{
|
||||
prepare_unique_url = true;
|
||||
}
|
||||
|
||||
bool prepare_unique_url;
|
||||
};
|
||||
|
||||
|
||||
class Item : public morm::Model
|
||||
{
|
||||
public:
|
||||
@@ -139,18 +150,11 @@ public:
|
||||
bool prepare_url();
|
||||
|
||||
|
||||
using morm::Model::insert;
|
||||
using morm::Model::update;
|
||||
|
||||
bool insert(morm::ModelData * model_data, bool update_whole_tree = true);
|
||||
bool insert(morm::ModelData & model_data, bool update_whole_tree = true);
|
||||
bool insert(bool update_whole_tree = true);
|
||||
|
||||
bool update(morm::ModelData * model_data, bool url_was_changed, bool update_whole_tree = true);
|
||||
bool update(morm::ModelData & model_data, bool url_was_changed, bool update_whole_tree = true);
|
||||
bool update(bool url_was_changed, bool update_whole_tree = true);
|
||||
|
||||
bool save(morm::ModelData * model_data, bool url_was_changed, bool save_whole_tree = true);
|
||||
bool save(morm::ModelData & model_data, bool url_was_changed, bool save_whole_tree = true);
|
||||
bool save(bool url_was_changed, bool save_whole_tree = true);
|
||||
bool update(morm::ModelData * model_data, bool update_whole_tree = true);
|
||||
|
||||
|
||||
/*
|
||||
@@ -166,9 +170,11 @@ public:
|
||||
*/
|
||||
static void do_migration(morm::ModelConnector * model_connector);
|
||||
|
||||
void propagate_connector();
|
||||
|
||||
protected:
|
||||
|
||||
long calc_items_by_url(long parent_id, const std::wstring & url);
|
||||
CalcItemsHelper calc_items_by_url(long parent_id, const std::wstring & url);
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user