|
@ -363,22 +363,6 @@ impl EntityGateway for PostgresGateway { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
async fn get_items_by_character(&self, char: &CharacterEntity) -> Vec<ItemEntity> {
|
|
|
async fn get_items_by_character(&self, char: &CharacterEntity) -> Vec<ItemEntity> {
|
|
|
let q = r#"select * from (
|
|
|
|
|
|
select distinct on (item_location.item)
|
|
|
|
|
|
item.id,
|
|
|
|
|
|
case
|
|
|
|
|
|
when item_location.location -> 'Inventory' is not null then
|
|
|
|
|
|
jsonb_set(item_location.location, '{Inventory,slot}', (array_position(inventory_slots.items, item.id))::text::jsonb),
|
|
|
|
|
|
else
|
|
|
|
|
|
item_location.location
|
|
|
|
|
|
end location,
|
|
|
|
|
|
item.item
|
|
|
|
|
|
from item_location
|
|
|
|
|
|
join item on item.id = item_location.item
|
|
|
|
|
|
order by item_location.item, item_location.created_at desc
|
|
|
|
|
|
) as i
|
|
|
|
|
|
where cast (location -> 'Inventory' ->> 'character_id' as integer) = $1
|
|
|
|
|
|
or cast (location -> 'Bank' ->> 'character_id' as integer) = $1"#;
|
|
|
|
|
|
let q = r#"select * from (
|
|
|
let q = r#"select * from (
|
|
|
select distinct on (item_location.item)
|
|
|
select distinct on (item_location.item)
|
|
|
item.id,
|
|
|
item.id,
|
|
|