snello CMS
  • Snello CMS
  • Get Started
  • Architecture
    • Snello API
    • Snello ADMIN
  • Docker Images
    • Database
    • Storage
    • Mail settings
    • Docker compose
  • Metadata
    • UUIDs
    • To reuse existing database tables
    • Advanced configuration
    • Reserved Metadata Names
  • Field Definitions
    • Data Types
    • Multijoin: database and rest queries
    • CRUD options
  • How to query using REST API
    • metadata api
    • filters & limit & sort
      • protect your api
  • Conditions
    • Multijoin conditions
  • Documents
    • Download endpoint
  • How to publish your web pages
  • Select Queries
  • Authentication & Authorization
    • User & Roles
    • Password recovery
    • Url Map Rules
  • Links
  • Draggables & Droppables
    • angular syntax
  • Deploy in Production
    • Let’s Encrypt
    • Remove Hashbang
    • Traefik
    • Rendertron
  • Notes
    • Micronaut - create extensions
    • Native image
    • Editor for code
    • Multi languages
  • k8s cache distributed
  • Developers Space
    • Java code
    • Angular code
  • Roadmap
    • Java Evolution
    • Angular Evolution
    • Next features
Powered by GitBook
On this page
Edit on GitHub

Conditions

The conditions aree the best way to define "custom queries".

Parameter conditions

You should define the conditions that will bypass the normal queries on metadata table. The conditions can be applied on different parameters in "and " or "or" combination.

You must define the metadata_name (the table that will be queried).

You can apply the condition that should be verified on parameters in some way:

  • _nn (not null)

  • _nie (not empty)

  • _gt (greater than)

  • _gte (greater equal than)

  • _lt (lower than)

  • _lte (lower equal than)

And you can mix the conditions using "&&" or "||".

studenti_id_gt = 20 && studenti_id_lt = 30
studenti_id_nn && join_table_nn

The query_params that will be used for the sql query

query_params: "studenti_id" 

The sub_query to concatenate after where in the sql query:

sub_query: "uuid in (
select classi_id from studenti_classi where studenti_id = ?
)" 

You can define a "separator" to concatenate more conditions.

A complete example:

metadata_name: "classi", 
condition: "studenti_id_nn && join_table_nn" 
metadata_name: "classi" 
query_params: "studenti_id" 
sub_query: "uuid in (select classi_id from studenti_classi 
where studenti_id = ?)"
Previousprotect your apiNextMultijoin conditions

Last updated 2 years ago