sascha@1015: sascha@1015: sascha@1015: sascha@1018: sascha@1018: User specific part sascha@1018: ------------------ sascha@1018: sascha@1018: sascha@1021: sascha@1021: sascha@1043: SELECT u.id AS user_id, c.id AS collection_id sascha@1043: FROM collections c JOIN users u ON c.user_id = u.id sascha@1043: WHERE u.gid = CAST(${user-id} AS uuid) sascha@1043: ORDER BY c.creation DESC sascha@1043: sascha@1021: sascha@1021: sascha@1043: SELECT a.id AS a_id, a.state AS a_state, a.gid AS a_gid, a.creation AS a_creation sascha@1043: FROM collection_items ci JOIN artifacts a ON ci.artifact_id = a.id sascha@1043: WHERE collection_id = ${collection_id} AND a.gid <> CAST(${artifact-id} AS uuid) sascha@1043: AND EXISTS (SELECT id FROM artifact_data WHERE artifact_id = a.id AND k = 'river' AND v = ${river}) sascha@1043: sascha@1043: --- TODO: We only need the 'master' artifacts! --- sascha@1021: sascha@1043: sascha@1043: sascha@1043: sascha@1043: SELECT id AS out_id FROM outs WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' sascha@1043: sascha@1043: sascha@1021: sascha@1043: SELECT name AS facet_name, num as facet_num, description AS facet_description sascha@1043: FROM facets WHERE out_id = ${out_id} ORDER BY num ASC, name DESC sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1021: sascha@1043: sascha@1043: sascha@1043: sascha@1043: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1018: sascha@1015: sascha@1015: