development #103

Merged
irfan merged 2 commits from development into production 2024-09-29 12:01:25 +00:00
6 changed files with 26 additions and 21 deletions

View File

@ -40,11 +40,13 @@ export class SupersetService {
}),
);
return { loginToken, csrfToken: response.data.result };
const cookie = response.headers['set-cookie'];
return { loginToken, csrfToken: response.data.result, cookie };
}
async getGuestToken(uuid: string) {
const { loginToken, csrfToken } = await this.getCSRFToken();
const { loginToken, csrfToken, cookie } = await this.getCSRFToken();
const data = {
resources: [{ type: 'dashboard', id: uuid }],
@ -52,11 +54,14 @@ export class SupersetService {
user: { username: 'pos_embed', first_name: 'pos', last_name: 'embed' },
};
const [requestCookie] = cookie[0].split(';');
const headers = {
'Content-Type': 'application/json',
Authorization: `Bearer ${loginToken}`,
Cookie: requestCookie,
'Content-Type': 'application/json',
'X-CSRFToken': `${csrfToken}`,
Referer: `${this.supersetURL}/v1/security/guest_token/`,
'Access-Control-Allow-Credentials': true,
};
const response = await firstValueFrom(

View File

@ -14,9 +14,9 @@ export default <ReportConfigEntity>{
unique_name: `${REPORT_GROUP.transaction_report}__cancel`,
label: 'Pembatalan',
table_schema: `transactions main
LEFT JOIN season_types s_period_type ON s_period_type.id::text = main.season_period_type_id
LEFT JOIN refunds refund ON refund.transaction_id = main.id and refund.status != 'cancel'
LEFT JOIN vip_codes vip ON vip.id::text = main.discount_code_id::text
LEFT JOIN season_types s_period_type ON s_period_type.id = main.season_period_type_id::uuid
LEFT JOIN refunds refund ON refund.transaction_id::uuid = main.id and refund.status != 'cancel'
LEFT JOIN vip_codes vip ON vip.id = main.discount_code_id::uuid
LEFT JOIN (
select item.transaction_id, sum(item.total_hpp) AS total_hpp_item
from transaction_items item

View File

@ -14,11 +14,11 @@ export default <ReportConfigEntity>{
unique_name: `${REPORT_GROUP.transaction_report}__giving_discounts`,
label: 'Pemberian Diskon',
table_schema: `transactions main
LEFT JOIN vip_codes vip ON vip.id::text = main.discount_code_id::text
LEFT JOIN vip_categories vip_category ON vip_category.id::text = vip.vip_category_id::text
LEFT JOIN users account ON account.id::text = vip.creator_id::text
LEFT JOIN user_privileges privilege ON privilege.id::text = account.user_privilege_id::text
LEFT JOIN season_types s_period_type ON s_period_type.id::text = main.season_period_type_id`,
LEFT JOIN vip_codes vip ON vip.id = main.discount_code_id::uuid
LEFT JOIN vip_categories vip_category ON vip_category.id = vip.vip_category_id
LEFT JOIN users account ON account.id = vip.creator_id::uuid
LEFT JOIN user_privileges privilege ON privilege.id = account.user_privilege_id
LEFT JOIN season_types s_period_type ON s_period_type.id = main.season_period_type_id::uuid`,
main_table_alias: 'main',
whereDefaultConditions: [
{
@ -37,7 +37,7 @@ export default <ReportConfigEntity>{
values: [false],
},
],
whereCondition(filterModel) {
whereCondition(_filterModel) {
return [
`main.discount_percentage is not null or main.discount_value is not null`,
];

View File

@ -14,12 +14,12 @@ export default <ReportConfigEntity>{
unique_name: `${REPORT_GROUP.transaction_report}__income_per_item_master`,
label: 'Pendapatan Per Item Master',
table_schema: `transactions main
LEFT JOIN transaction_items tr_item ON tr_item.transaction_id::text = main.id::text
LEFT JOIN transaction_item_breakdowns tr_item_bundling ON tr_item_bundling.transaction_item_id::text = tr_item.id::text
LEFT JOIN transaction_items tr_item ON tr_item.transaction_id = main.id
LEFT JOIN transaction_item_breakdowns tr_item_bundling ON tr_item_bundling.transaction_item_id = tr_item.id
LEFT JOIN refunds refund ON refund.transaction_id = main.id
LEFT JOIN refund_items refund_item ON refund_item.refund_item_id = tr_item.item_id::uuid
LEFT JOIN items item ON item.id::text = tr_item.item_id::text
LEFT JOIN users tenant ON tenant.id::text = item.tenant_id::text
LEFT JOIN refund_items refund_item ON refund_item.refund_item_id::text = tr_item.item_id::text`,
LEFT JOIN users tenant ON tenant.id::text = item.tenant_id::text`,
main_table_alias: 'main',
whereDefaultConditions: [
{

View File

@ -14,11 +14,11 @@ export default <ReportConfigEntity>{
unique_name: `${REPORT_GROUP.transaction_report}__income_per_item`,
label: 'Pendapatan Per Item',
table_schema: `transactions main
LEFT JOIN transaction_items tr_item ON tr_item.transaction_id::text = main.id::text
LEFT JOIN transaction_items tr_item ON tr_item.transaction_id = main.id
LEFT JOIN refunds refund ON refund.transaction_id = main.id
LEFT JOIN refund_items refund_item ON refund_item.refund_item_id = tr_item.item_id::uuid
LEFT JOIN items item ON item.id::text = tr_item.item_id::text
LEFT JOIN users tenant ON tenant.id::text = item.tenant_id::text
LEFT JOIN refund_items refund_item ON refund_item.refund_item_id::text = tr_item.item_id::text`,
LEFT JOIN users tenant ON tenant.id::text = item.tenant_id::text`,
main_table_alias: 'main',
whereDefaultConditions: [
{

View File

@ -14,7 +14,7 @@ export default <ReportConfigEntity>{
unique_name: `${REPORT_GROUP.transaction_report}__reconciliation`,
label: 'Rekonsiliasi',
table_schema: `transactions main
LEFT JOIN payment_methods payment ON payment.id::text = main.payment_type_method_id::text`,
LEFT JOIN payment_methods payment ON payment.id = main.payment_type_method_id::uuid`,
main_table_alias: 'main',
defaultOrderBy: [],
lowLevelOrderBy: [],