mirror of
https://github.com/matrix-construct/construct
synced 2024-06-08 21:18:57 +02:00
modules/console: Add user devices delete cmd.
This commit is contained in:
parent
2122412c6d
commit
8dc50db2dc
|
@ -14381,6 +14381,47 @@ console_cmd__user__devices(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__user__devices__delete(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
const params param{line, " ",
|
||||||
|
{
|
||||||
|
"user_id", "device_id"
|
||||||
|
}};
|
||||||
|
|
||||||
|
const m::user::id &user_id
|
||||||
|
{
|
||||||
|
param.at("user_id")
|
||||||
|
};
|
||||||
|
|
||||||
|
const string_view &device_id
|
||||||
|
{
|
||||||
|
param.at("device_id", string_view{})
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::user::devices devices
|
||||||
|
{
|
||||||
|
user_id
|
||||||
|
};
|
||||||
|
|
||||||
|
if(device_id)
|
||||||
|
{
|
||||||
|
devices.del(device_id);
|
||||||
|
out << device_id << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
devices.for_each([&out, &devices]
|
||||||
|
(const auto &event_idx, const string_view &device_id)
|
||||||
|
{
|
||||||
|
devices.del(device_id);
|
||||||
|
out << device_id << std::endl;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__user__devices__update(opt &out, const string_view &line)
|
console_cmd__user__devices__update(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue