BusinessInvoiceFieldSqlDao.sql.stg

40 lines | 702 B Blame History Raw Download
group BusinessInvoiceField;

CHECK_TENANT() ::= "tenant_record_id = :tenantRecordId"
AND_CHECK_TENANT() ::= "AND <CHECK_TENANT()>"

getFieldsForInvoice(invoice_id) ::=<<
select
  invoice_id
, name
, value
from bin_fields
where invoice_id = :invoice_id
<AND_CHECK_TENANT()>
;
>>

addField(invoice_id, name, value) ::=<<
insert into bin_fields (
  invoice_id
, name
, value
, account_record_id
, tenant_record_id
) values (
  :invoice_id
, :name
, :value
, :accountRecordId
, :tenantRecordId
);
>>

removeField(invoice_id, name, value) ::= <<
delete from bin_fields where invoice_id = :invoice_id and name = :name <AND_CHECK_TENANT()>;
>>

test() ::= <<
select 1 from bin_tags where <CHECK_TENANT()>;
>>