feat: ini shared content report

pull/4/head
Firman Ramdhani 2024-06-25 13:45:23 +07:00
parent cb8b1bfd6b
commit 0bed18b439
9 changed files with 176 additions and 0 deletions

View File

@ -15,4 +15,7 @@ export enum TABLE_NAME {
USER_PRIVILEGE_CONFIGURATION = 'user_privilege_configurations', USER_PRIVILEGE_CONFIGURATION = 'user_privilege_configurations',
VIP_CATEGORY = 'vip_categories', VIP_CATEGORY = 'vip_categories',
VIP_CODE = 'vip_codes', VIP_CODE = 'vip_codes',
REPORT_BOOKMARK = 'report_bookmark',
EXPORT_REPORT_HISTORY = 'export_report_history',
} }

View File

@ -0,0 +1,3 @@
export * from './report-config.constant';
export * from './report-group.constant';
export * from './report-status.constant';

View File

@ -0,0 +1,53 @@
export enum DATA_FORMAT {
TEXT = 'text',
TEXT_UPPERCASE = 'text_uppercase',
TEXT_LOWERCASE = 'text_lowercase',
NUMBER = 'number',
MINUS_NUMBER = 'minus_number',
DATE_EPOCH = 'date_epoch',
DATE_TIMESTAMP = 'date_timestamp',
CURRENCY = 'currency',
MINUS_CURRENCY = 'minus_currency',
STATUS = 'status',
BOOLEAN = 'boolean',
PERCENTAGE = 'percentage',
}
export enum DATA_TYPE {
DIMENSION = 'dimension',
MEASURE = 'measure',
}
export enum FILTER_TYPE {
TEXT_EQUAL = 'text_equals',
TEXT_NOT_EQUAL = 'text_notEquals',
TEXT_CONTAINS = 'text_contains',
TEXT_MULTIPLE_CONTAINS = 'text_multiple_contains',
TEXT_MULTIPLE_REGEXP_CONTAINS = 'text_multiple_regexp_contains',
TEXT_NOT_CONTAINS = 'text_notContains',
TEXT_START_WITH = 'text_startWith',
TEXT_END_WITH = 'text_endWith',
TEXT_IN_MEMBER = 'text_inMemberText',
TEXT_IN_RANGE = 'text_inTextRange',
DATE_IN_RANGE_EPOCH = 'text_inDateRange_epoch',
DATE_IN_RANGE_TIMESTAMP = 'text_inDateRange_timestamp',
NUMBER_EQUAL = 'number_equals',
NUMBER_NOT_EQUAL = 'number_notEqual',
NUMBER_GREATER_THAN = 'number_greaterThan',
NUMBER_GREATER_THAN_OR_EQUAL = 'number_greaterThanOrEqual',
NUMBER_LESS_THAN = 'number_lessThan',
NUMBER_LESS_THAN_OR_EQUAL = 'number_lessThanOrEqual',
NUMBER_IN_RANGE = 'number_inRange',
}
export enum FILTER_FIELD_TYPE {
select = 'select',
input_text = 'input_text',
input_number = 'input_number',
input_tag = 'input_tag',
date_picker = 'date_picker',
date_range_picker = 'date_range_picker',
month_range_picker = 'month_range_picker',
}

View File

@ -0,0 +1,5 @@
export enum REPORT_GROUP {
// PATTERN => MODULE__MENU__SUB_MENU
// EXAMPLE:
contact__reports = 'contact__reports',
}

View File

@ -0,0 +1,6 @@
export enum REPORT_HISTORY_STATUS {
PROCESSING = 'processing',
DONE = 'done',
FAILED = 'failed',
CANCEL = 'cancel',
}

View File

@ -0,0 +1,19 @@
import { BaseEntity } from 'src/core/modules/domain/entities/base.entity';
import { REPORT_HISTORY_STATUS } from '../constant';
export interface ExportReportHistoryEntity extends BaseEntity {
group_name: string;
unique_name: string;
label: string;
file_name: string;
total_data: number;
processing_data: number;
file_url?: string;
status?: REPORT_HISTORY_STATUS;
last_process_offset?: number;
last_process_limit?: number;
total_resume?: number;
last_resume_created_at?: number;
query_export?: string;
canceled_at?: number;
}

View File

@ -0,0 +1,9 @@
import { BaseEntity } from 'src/core/modules/domain/entities/base.entity';
export interface ReportBookmarkEntity extends BaseEntity {
group_name: string;
unique_name: string;
label: string;
applied?: boolean;
configuration?: any;
}

View File

@ -0,0 +1,53 @@
import { BaseModel } from 'src/core/modules/data/model/base.model';
import { Entity, Column } from 'typeorm';
import { REPORT_HISTORY_STATUS } from '../constant';
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
import { ExportReportHistoryEntity } from '../entities/export-report-history.entity';
@Entity(TABLE_NAME.EXPORT_REPORT_HISTORY)
export class ExportReportHistoryModel
extends BaseModel<ExportReportHistoryEntity>
implements ExportReportHistoryEntity
{
@Column('varchar')
group_name: string;
@Column('varchar')
unique_name: string;
@Column('varchar')
label: string;
@Column('varchar')
file_name: string;
@Column('varchar', { nullable: true })
file_url: string;
@Column('int', { default: 0 })
total_data: number;
@Column('int', { default: 0 })
processing_data: number;
@Column('enum', { nullable: true, enum: REPORT_HISTORY_STATUS })
status: REPORT_HISTORY_STATUS;
@Column('int', { default: 0 })
last_process_offset: number;
@Column('int', { default: 0 })
last_process_limit: number;
@Column('int', { default: 0 })
total_resume: number;
@Column('bigint', { nullable: true })
last_resume_created_at: number;
@Column('varchar', { nullable: true })
query_export: string;
@Column({ type: 'bigint', nullable: true })
canceled_at: number;
}

View File

@ -0,0 +1,25 @@
import { BaseModel } from 'src/core/modules/data/model/base.model';
import { Entity, Column } from 'typeorm';
import { ReportBookmarkEntity } from '../entities/report-bookmark.entity';
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
@Entity(TABLE_NAME.REPORT_BOOKMARK)
export class ReportBookmarkModel
extends BaseModel<ReportBookmarkEntity>
implements ReportBookmarkEntity
{
@Column('varchar')
group_name: string;
@Column('varchar')
unique_name: string;
@Column('varchar')
label: string;
@Column('bool', { nullable: true, default: false })
applied: boolean;
@Column('json', { nullable: true })
configuration: any;
}