# Changelog All notable changes to this project will be documented in this file. ## [unreleased] ### 🚀 Features - Upload multiple payment file - Search now cover workName - Add installments data - Add head method - *(minio)* Add get presigned function - Add head method for file endpoint - *(file)* Add head endpoint - *(util)* Add retry function - *(service)* Add installments to payload - Add head to more endpoint - Use retry function - Search customer now cover customer name - Search code of user - Add more payment status - Make flow endpoint same response structure - Search quotation now cover customer name and code - Workflow permission - Add util function to include or not include condition - Add installment no to quotation data - Search customer now cover more field - Add attributes to each product in service - Add more quotation status - Add more status - Add toggle on and off status - Add status filter query string - Add status filter - Add relation for agent - Update now detect already exists step - Add option to share product inside one group - Add support for getting relation - Add more pay condition - Add notification database structure - Add endpoint skeleton ### 🐛 Bug Fixes - File location - *(employee)* Missing permission check - *(keycloak)* Now return all roles - Payment sort - Wrong sort - Error when no branch is found - Dup on update - Wrong variable used - Error dup - Wrong decoration - Error on update - Wrong code - Respect relation - Payload - Product was delete on not send list product - Typo - Wrong operation - Auth related error ### 🚜 Refactor - Rename endpoints - *(keycloak)* Now only expose role management endpoint - Remove unused - Upload now return presigned url instead of redirect - Separate init user to utils - List also include relation - Don't include condition if no query - [**breaking**] Payment sys - Remove unused enum - Accept quotation specific status filter instead - Change installments data ### ⚙️ Miscellaneous Tasks - Cleanup - Deps ver - Remove unused - Add migration - Add tag - Update tags - Fix migration - Update constraits - Migration - Update deps - Add database relation for notification group ### Experimental - Api doc ## [0.4.0] - 2024-10-18 ### 🚀 Features - Add filter registeredBranch - Add pay split field - Add more relation - Add count by relation - Add field - Detect if agent price - Update structure - Add payment endpoints (incomplete) - Add swagger tag - Add quotation stats by group - Add workflow template - Add config endpoint - Work length not match - Also return full service back - Handle running no on delete customer - Add payment post process - Update response add relation - Add view permission - Also include customer and its registered branch - Add workflow to service - Add update status flow - Add conditional query for customer - Add conditional company scope query - Add metadata - Add payment for split - Search also cover code - Add payment remark - Unlock product code - Update payload and update endpoint - Pre create payment data - Update quotation payment data - Detect same username / email - Add vat exclude feature - Include more relation - Order passport - Add query param - Quotation code running no reset at month - Search code now case insensitive - Add remark field - Payment data pull date from split data - Add max worker field - Also return full address ### 🐛 Bug Fixes - Relation - System role not get filtered - Error - Missing relation - Calculate price - Paging - Vat calc - Wrong path - Calc vat after discount only - Array length not match - Word case - Wrong price per unit - Discount not have effect - Error relation - Wrong case - Fallback for one time payment - Delete error - Change running no to custoer branch id instead - Double payment data on update - Change to non percent - Wrong vat excluded - Make remark accept null - Calc vat - Empty payment data on full payment ### 🚜 Refactor - Include full detail when get by id - Relation - Quotation query and relation - Update quotation structure and endpoint - Throw common error with util function instead - [**breaking**] Remove unused field - Make field optional - Remove unnecessary join - Change sort - Calculate utility - Update quotation - Change running no to use parent id - Add work status and process user - Adjust field - [**breaking**] Change branch to registered branch scope - Bring back vat excluded - Search case ### ⚙️ Miscellaneous Tasks - Update deps - Update constraints - Clean - Update field quotation - Add migration - Add tag - Update tsconfig to not truncate error - Clean up - Relation constraints ## [0.3.6] - 2024-09-27 ### 🚀 Features - Detect same name of product in the same company - Also include registered branch for display as options ### ⚙️ Miscellaneous Tasks - Remove log ## [0.3.5] - 2024-09-26 ### 🚀 Features - Update quotation endpoints with permission ### 🐛 Bug Fixes - Update sort ## [0.3.4] - 2024-09-25 ### 🐛 Bug Fixes - Delete customer branch hq now also delete parent ### ⚙️ Miscellaneous Tasks - Migration ## [0.3.3] - 2024-09-25 ### 🐛 Bug Fixes - Branch under headquarter display condition ## [0.3.2] - 2024-09-25 ### 🚀 Features - Add option to get list with head - Add role that can view another branch ### 🐛 Bug Fixes - Permission condition ### 🚜 Refactor - Remove role from allow cross branch ## [0.3.1] - 2024-09-25 ### 🐛 Bug Fixes - User email not save in keycloak ## [0.3.0] - 2024-09-24 ### 🚀 Features - Add flag - Add permision check - Filter view by role - User permission on delete - Permission control - Query also search for passport number - Add branch bank qr - Return relation - Multiple profile imagea - Count stats - Also remove file when delete data - Customer branch permission - Control list view by role - Scope view by role - Double check permission customer branch - Employee permission check - Permission check employee - Remove some roles from manage some endpoints - Scope stats - Re-add head of sale to be able to manage endpoints - Add delete image endpoint - Customer permission - Product group permission - Allow sale to manage self branch - Branch image multi - Filter branch by status - Reuse function - Add field - Upload and select multiple image - Deprecate unused endpoints - Add utility function - Update field - Product group permission check - Add more helper function - Refactor permission product service - Image upload product service - Shared between company - Add file location for employee - Add helper function to construct address search - Add address fields - Branch attachment - Add fields customer - File upload customer branch - Customer branch citizen - Include more relation in employee - Allow company change - Prevent from change company ### 🐛 Bug Fixes - Type - Count by group - Change role name - Error updatedAt - Cannot set role as expected - Permission failed - Stats not take scope into account - Fix no perm - Error missing var - Error - Protect endpoints - Wrong condition check - Missing auth - Missing field input - Path - Only return file name - Backward compat - Relation - User in branch not see hq - Wrong condition - Condition - Role missing on edit - Head branch not listed - User permission control - Stats not accurate due to prev commit - Customer edit not consider related branch perm - Wrong permission condition - Wrong position - Error user - Error when registered branch is null - Also prefix runningNo on generate - Missing selected image field - Missing field - Always include from head branch - Typo - Case typo - Conflict endpoints - Tag - Wrong payload - Customer code should not have company code - Update payload - Typo and handle delete - Relation constraits - Missing fields - Error required args - Error on edit - Tree permission ### 🚜 Refactor - Use kysely query builder instead - Roles - Permission - [**breaking**] Remove product type - [**breaking**] Remove unnecessary endpoint - Permission user - View condition and permission - Small adjustment - Remove unused role - Adjust function - Scope view - Update role - Move file out - Separate function - Change file name - Move file - Organize file - Drop supported presigned url return - Branch bank delete handle - Update file path - Add selectedImage for profile shown - Structure - Fix permission for sure - Use factory function for perm check - Only query if have - [**breaking**] Remove deprecated - Where conditions - Add helper function - Use helper function instead for easier fix - Middleware - Use helper function - Separate and use helper function - Relation - Relation helper function - Use relation helper function - Use utility function - File upload and image - Helper function manual throw - Use helper - Helper function - Input fields (branch, user) - Reduce code - Customer structure - Employee - [**breaking**] Customer (employer) fields - Combine payload - Make field optional - Change payload ### ⚙️ Miscellaneous Tasks - Format - Update migration - Remove unused - Add migration - Add helper function - Add more helper function - Update swagger tags - Migration - Migrations - Add local build action - Remove localhots (not working when in container) - Remove join - Update endpoints tag - Update tag - Database refactor ## [0.2.1] - 2024-08-30 ### 🚀 Features - Insert province district sub-district into db - Add headoffice as relation ### 🐛 Bug Fixes - Wrong endpoint - Build error - Branch manager cannot create user - Wrong permission check - Branch manager must not increase your own role - Wrong condition - Wrong field extract ### 🚜 Refactor - Also return employee count of customer ### Change - Make user can view only user within branch ## [0.2.0] - 2024-08-29 ### 🚀 Features - Bump deps version - Add user relation on query - Add count gender by query - Include relation - Permmission branch - Add product code - Remove scoped branch (change soon) - Product related permission - Customer permission role - Add more role to each endpoint - Add user and assign to branch at the same time - Add product type to service - Add count of service under group / type - Query service by product type - Add more role to endpoints - Protect endpoints with role - Scope permission in separated customer branch endpoint - Add query string - Order relation - Add relation to employee - Add count branch - Change format - Add user real name to log - Add query param to include full detail in service - Add quotation structure - Add get quotation by id endpoint - Add quotation list endpoint (no query) - Structure input before insert to database - Create quotation endpoint (test required) - Add quotation endpoint (complete) - Exclude some work from service - Add original service reference - Delete quotation endpoints - Update quotation - Generate quotation code - Image endpoint get or upload - Image endpoint (branch endpoint) - Add bank to branch payload (optional) - Add bank field - New gen branch code - Change code gen of user - Check code constraints - [**breaking**] Code gen customer - Now system do not show system role - Add endpoint for get branch admin - Add field middleName and name prefix (optional) - Add status filter - Service code now accept any string - Filter by customerId - Update code generator - Remove unused code generator - Add util function delete folder minio - Create / update customer branch - Also consider code from head office - Add contact name field - Update status of headoffice so it cannot be delete - Add code customer field - Add new endpoint for get or download file - Add upload file employee endpoint - Add employee field - Change uuid to cuid - Allow disable logger by .env - Add workflow for local lan deploy - Add set image endpoints for employee - Map image - Add web url - Check if user exist ### 🐛 Bug Fixes - Unused field - Raw query relation - Wrong key - Code not return - Wrong relation included - Wrong instance used - Error wrong cond - Condition - Sql query - Add image link - Typo - Code always update on customer type CORP - Error fk on empty payload registeredBranch field - Error on disable log - Calculation - Wrong type - Error and price calc - Error dep - Error update on empty productGroupId - Condition always true - Relation ordering - Condition not cover - Wrong create value - Delete unused branch cause error new branch same code - Update branch status when assign user to branch - Typo 9 (should be 0) - Wrong condition - Wrong field used - Stat should not count user with system role - Wrong field - Error due to structure changed - Customer code come from wrong data - Missing zero fill - Error due top field dropped - Code not convert to uppercase can't create branch - Order - Wrong behaviour - Wrong length slice - Update field can be optional - Add relation when get by id - Wrong string conversion - Code case ### 🚜 Refactor - User relation - Adjust code - Accept branchNo instead of auto - Change field to null able - Update auth setting - Update structure - Structure - Update constraints - Reorder endpoints (affect swagger) - Swap logger - Do not update parent status to active - Change relationship - Change order - [**breaking**] User code gen - [**breaking**] Employee code gen - Filter out system role - Only filter log api - Use prisma nested create instead - Update new employee code gen in quotation endpoint - Update code gen when change employee branch - Customer create and update process - Use nested relation instead - Dry - Change datetime field to date only - Drop field - Update customer branch file upload endpoint - Change to response url instead ### ⚙️ Miscellaneous Tasks - Update upload time - Add migration - Remove log - Remove unnecessary - Remove unused - Format - Make nodemon watch .env file ### Change - Branch code now have 5 digit ### Feaet - Protect by roles ## [0.0.3] - 2024-07-01 ### 🚀 Features - Role based permission endpoints - Can create branch when create customer - Also delete branch that not sent on update - Update query to also return branch - Prepare for dynamic user type - Sort stats - Add missing field - Update keycloak function - Employee code gen - Product group endpoints - Scope customer branch by customer id - Count customer by type - Customer branch attachment - Update customer branch - Must not delete if status is not CREATED - Employee work endpoints - Product type endpoints - Minio util func - Return null if no image exist - Employee with relation on create / update - Customer type filter - Update schema - Add remark field - Service api endpoint - Count data - Also update customer status to active - Count employee - Update field - Relation and auto gen code - Search branch by customer code - Add code to customer branch for query purpose - Prevent empty foreign id - Work endpoints - Scope type by productGroupId - Prevent invalid groupId sent - Add count of relation(s) to each record - Return only one record - Count employee by gender - Product endpoints - Service and product with work relation - Only get url if object exists - Change some field to optional - Also customer all related field - Feat update employee code - Filter gender - Add query string - Filter status created and active treated as same - Update work endpoints - Update product fields - Add productType relation i/o - Image endpoint - Add fields - Update status on used - Expose image endpoint to public - Add product stats - Make field optional - Update add status - Change status of product type after used - Add parameter for base only work - Separate service image endpoint - Add order field - Order by status field - Add query product service together - Add relation to service - Add query - Inject sessionId for logging purpose - Add status query string param - Add security - Paging group / type product - Adjust data type - Add git ignore - Add user name to log data - Employee history - Add user update info to history - Stats relation - Add minio util function ### 🐛 Bug Fixes - Edit should not require telephone no - Do not remove default role - Add missing field - Wrong object delete - Validate error - Wrong data type - Wrong field - Type - Change structure - Type error - Wrong endpoints - Typo - Missing v1 prefix - Fixed branch no digit - Input validation - Wrong table ref - Missing image url - Wrong understanding of system - Wrong relation join - Wrong cond - Relation - Change dev message to code - Group code - Product code - Type code - Work & service code - Branch code - Customer branch code - Employee code - Permission & user code - Auth & role code - Filter not as expected - Error not found (wrong table) - Error productId - Missing input field - Update service - Wrong instance use - Make optional - Missing type - Update status order - Total count bigint cannot be serialize - Service not included in result - Query - Import - Missing paging param - Error relation - Fk - Cannot disable user ### 🚜 Refactor - Branch code gen transaction - Update code gen strategy (branch user) - Update code gen strategy (customer) - [**breaking**] Add v1 prefix to endpoints - Update isolation level - Update log - Move security to route by route - [**breaking**] Change typo field and reset migration - Add field to type ### ⚙️ Miscellaneous Tasks - Db migration add new table - Format - Add migration - Migration - Update migration - Reorder swagger endpoints - Deps ver - Add bracket - Add format - Change swagger order - Add prisma kysely for query builder - Bumps deps ver - Update env example ## [0.0.2] - 2024-04-19 ### 🚀 Features - Also return with contact - Add field - Get role list of user - Edit user role - Store username - Add branch image - Auto gen branch no - Add hq tel field - Add more searching field - Menu and menu component for permission endpoint - Use role name instead - Update user code that has no associated branch - Change to some field to optional - Update contact to be nullable when request ### 🐛 Bug Fixes - Also delete user in keycloak when delete user - Update contact endpoint - Error when update record not found - Wrong structure return - Error when not sent role - Missing parameter username on edit - Use role name instead (edit endpoint) ### 🚜 Refactor - Add head office indicator to stats - Add user to keycloak on create user - Move field lineId contact field - Move field - Update branch endpoint - Add more field - Change field name ### ⚙️ Miscellaneous Tasks - Add migration - Cleanup - Update db - Db migrate - Db migration - Bump deps ver - Sort tag permission ## [0.0.1] - 2024-04-11 ### 🚀 Features - Keycloak service add other params - Add minio client - Add minio dep - Keycloak user and role management - Add province, district, sub-district endpoint - Change database field to enum with default - Add branch controller - Get branch endpoint - Delete branch endpoint - Add type for create and update endpoint - Update database field - Create branch endpoint - Edit branch endpoint - Include relation response when create and delete - Branch contact controller - Create branch contact endpoint - Delete branch contact endpoint - Add type to http error dev message - Runtime migration - Add migration - User endpoints (crud, many-to-many branch) - Add elasticsearch - Add log middleware - Logging data structure and conditioan level - Use middleware - Add more dev message - Check if user in in used - Add user stat for each branch - Temporary generate code for branch and user - Update status when delete user or branch - Filter by branch type (head/sub) and relation - Status input on created and update - Customer create endpoint - List customer - List customer by id - Delete customer - Edit customer endpoint - Add update user data endpoint - Add customer branch controller - Add type for create and edit - Create customer branch endpoint - Edit customer branch endpoint - List customer branch - Get employee of customer branch - Get customer branch by id - Delete customer branch - Add gender field to database - Auto gen branch code - Auto gen user code - Employee endpoints - Stat by userType - Stats user by user type - Require user to change password on first login - Filter out internal roles (3 for now) - Add attachment to user controller - Add more user field - Auto generate customer code - Check for permission using roles - Delete user - Add query param to include user branch - Detect self reference - Emplyee checkup & other info endpoints - Get branch stats by hq or br - List by headOfficeId & get with contact ### 🐛 Bug Fixes - Empty user info when crud - Missing type - Build script - Missing package - Create branch head office condition when not send - Update condition and response relation - Missing qr code image url on get - Error reading variable - Filter out non-api - Filter out after finish response - Image not on delete data - Remove parent relation - Delete branch from user wrong body - Update status once used and must not delete - Missing auth - Bad commit 578fc225 - Missing image url - Error when record not found on update - Input type not matched with db - Error when trying to update - Error on not exist - Optional query - Data ordering - Type error (temporary) - Migration reset - Update type should not require customerType - Missing full stop - Typo - Auto gen user code ### 🚜 Refactor - Change database structure - Use same function to get img location - Add devMessage field (useful in front-end) - Add devMessage to error - Set status to 201 on create data - Change method - Remove suffix from field - Recreate migration file - Update schema and migration - Change from required to not required - Database fields - Auto generate code (may change in the future) - Do not update status if not created - Customer db - Update type - Field name - Nullable on create - Change condition order ### ⚙️ Miscellaneous Tasks - Small code adjustment - Add dev script - .env example add elasticsearch and minio - Change devMessage on error - Deps elasticsearch - Reset migration - Migration - Move file - Format - Add tags to open api spec (for sorting purpose) - Group two controller together - Restructure - Remove user branch tag (merged with branch user) - Sort tag - Update package name - Add migration ### Refacotr - Change type from object to string instead