Commit Graph

242 Commits

Author SHA1 Message Date
YuehuCao
f95552ff4d chore: add local testing configs and MongoDB message templates 2025-08-11 18:50:43 +08:00
YuehuCao
830311fe7e feat(routes): add API setup support for route files 2025-08-11 16:14:37 +08:00
YuehuCao
c968f3a594 chore(test): remove unusful tests 2025-08-11 15:47:08 +08:00
YuehuCao
350270fe6e refactor(services): correct misleading error log output 2025-08-11 15:40:29 +08:00
YuehuCao
0a01b1c6c6 feat(service): Add email status update handling for bounce cases 2025-08-11 15:33:43 +08:00
YuehuCao
1d6f41c3b5 Refactor(application): Extract default email as magic values to avoid hardcoding 2025-08-11 15:30:40 +08:00
YuehuCao
11c1cc811d Refactor(application): Extract frequently used value into class-level constant
email_sender_hub.py: extract email_sender_manager = EmailSenderManager()
notification_hub.py: extract notification_manager = NotificationManager()
template_message_hub.py: extract template_message_manager = TemplateMessageManager()
template_message_hub.py: add more details in render_template function
2025-08-11 15:21:17 +08:00
dongli
8caa8e6b31 Add dummy change to trigger ci/cd 2025-08-10 18:21:39 -07:00
YuehuCao
cc90c862d7 feat(multi-tenant): define the send status and bounce type 2025-08-09 11:57:37 +08:00
YuehuCao
b6f8b70f69 fix(notification): some small changes 2025-08-09 11:56:00 +08:00
YuehuCao
7cb5ba4a78 refactor(version): replace legacy version with HTML update 2025-08-09 11:47:38 +08:00
YuehuCao
b5c9ab6126 feat(email): implement multi-tenant delivery function 2025-08-09 11:34:15 +08:00
YuehuCao
4187c95743 feat(email_comsumer): introduce multi-tenant delivery system 2025-08-09 11:27:17 +08:00
YuehuCao
d164b6f567 feat(email_sending): introduce multi-tenant delivery system 2025-08-09 11:25:47 +08:00
Nicolas
04acd78d78 fix: connect to existing named queue instead of creating anonymous queue
- Change AsyncMQClient to connect to existing persistent queue by name
- Fix issue where DevOps Service created temporary anonymous queues instead of consuming from the correct named queue
- This allows consuming the 42 backlogged messages in freeleaps.devops.reconciler.output queue
- Change queue properties: exclusive=False, auto_delete=False, durable=True
- Resolves the core issue where messages were split between persistent and temporary queues
2025-08-08 12:45:21 +08:00
Nicolas
4340949f57 fix: make startup and shutdown event handlers async in common provider
- Fix TypeError: object NoneType can't be used in 'await' expression
- FastAPI requires event handlers to be async functions
- This was blocking the entire application startup sequence
- Fixes the issue where message queue consumers were not starting properly
2025-08-08 12:33:14 +08:00
Nicolas
e4fe9394b1 fix: use environment variable for RabbitMQ output queue name
- Add RABBITMQ_OUTPUT_QUEUE_NAME environment variable support
- Fix hardcoded queue name 'reconciler.output' to use configurable queue name
- Default to 'freeleaps.devops.reconciler.output' if env var not set
- Add debug logging to show which queue name is being used
- This fixes the issue where 42 messages were stuck in the output queue due to queue name mismatch
2025-08-08 12:01:47 +08:00
Nicolas
b5ca0cf0f5 fix: update devops service to subscribe to correct reconciler heartbeat queue 2025-08-07 18:29:59 +08:00
YuehuCao
2f10275493 refactor(architecture): implement 5-layer separation
for both template message and email senders, their workflow will follow:
api->application->business->service->infra
2025-08-07 12:58:19 +08:00
YuehuCao
58d085a4c6 feat(api): re-code the api interfaces for template message and email senders 2025-08-07 12:49:12 +08:00
YuehuCao
c1148a44d5 feat(models): add indexs and models
add high-frequent indexes for TemplateMessageDoc and EmailSenderDoc
add some models that will be used in sending email
2025-08-07 12:44:46 +08:00
dongli
d680b9e015 Fix check_deployment_status 2025-08-03 21:39:39 -07:00
zhenyus
879e45eeb5 fix: correct deployment TTL calculation in DeploymentService
Updated the TTL calculation in the DeploymentService to multiply by 3600 instead of 60, ensuring accurate time-to-live settings for deployments.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 12:22:24 +08:00
zhenyus
6c60a0b6a5 fix: update deployment service to use correct product ID
Changed the parameter name from deployment_project_id to deployment_product_id in the DevOpsReconcileRequest to ensure accurate referencing of the product associated with the deployment.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 04:04:19 +08:00
zhenyus
5f3368cbdc fix: correct typo in BASE_RECONCILE_URL parameter in DeploymentService
Updated the parameter name in the _start_deployment method to match the corrected constant in site_settings.py, ensuring consistency across the codebase.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:51:15 +08:00
zhenyus
e41aa3d983 fix: correct typo in BASE_RECONCILE_URL in site_settings.py
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:41:26 +08:00
zhenyus
6ebac252b0 refactor: change DevOpsReconcileOperationType to inherit from str and Enum
Updated the DevOpsReconcileOperationType class to inherit from both str and Enum, enhancing its usability as a string enumeration in the application.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:28:06 +08:00
zhenyus
2dd73c0734 refactor: enhance lazy initialization and error handling in message consumer startup
Updated the message consumer initialization to occur lazily during the startup event, improving application startup performance. Added detailed logging for service initialization, registration, and error handling to enhance traceability and robustness during startup and shutdown processes.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:01:11 +08:00
zhenyus
95b6560ffd refactor: improve clarity of subscriber startup process in message_queue.py
Updated comment to specify that the subscriber starts in the background, enhancing code readability and understanding of the asynchronous behavior.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 02:48:55 +08:00
zhenyus
9283e52e48 feat: enhance message consumer startup and shutdown logging in message_queue.py
Added print statements to log the status of message consumers during startup and shutdown processes, improving traceability and debugging capabilities.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 02:38:33 +08:00
zhenyus
113bc2bc75 fix: ensure consistent formatting in requirements.txt by removing redundant line
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-01 09:12:19 +08:00
zhenyus
ebc37bbd0d refactor: streamline DevOpsReconcileRequest by removing redundant code
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-01 09:06:42 +08:00
zhenyus
14eb5abda6 refactor: remove unnecessary @dataclass decorator from DevOpsReconcileRequest
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-01 09:03:39 +08:00
zhenyus
d74967db55 feat: add RabbitMQ configuration to app settings
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-01 00:15:06 +08:00
6ea40142ac Merge pull request 'Add template fastapi app, this can be used for future extension' (#11) from feature/dax/devops-svc into dev
Reviewed-on: freeleaps/freeleaps-service-hub#11
2025-07-31 16:11:36 +00:00
zhenyus
d0aa2ba14b Add message queue registration in application bootstrap and update dependencies
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-07-30 10:50:22 +08:00
YuehuCao
e46c81c993 docs(tests): add guide for generating coverage reports 2025-07-28 11:09:46 +08:00
YuehuCao
b849e5f11b test: add integration test between template_message and email_sender services layer and data layer
- Achieve 90%+ coverage
2025-07-28 11:06:57 +08:00
YuehuCao
def50f709f test: add unit tests for template_message and email_sender services
- Achieve 100% coverage for both services
2025-07-28 11:03:01 +08:00
YuehuCao
9cb29cd400 fix(services): correct spelling errors 2025-07-28 10:55:41 +08:00
YuehuCao
bb493700f0 refactor(services): remove unreachable code
- Delete redundant logic after line 22's early return
2025-07-28 10:53:07 +08:00
YuehuCao
2d3adb0936 fix: re-submit due to missing some contents 2025-07-25 19:16:40 +08:00
YuehuCao
4f4587893a feat(api): add CRUD interfaces for message templates and email senders 2025-07-25 19:05:29 +08:00
YuehuCao
fec7ac6071 feat(tenant): enable customization of message templates and email senders 2025-07-25 19:04:06 +08:00
YuehuCao
2637ee864a chore(template): seed initial global message templates 2025-07-25 19:01:57 +08:00
YuehuCao
f7ad36bef8 feat(template): define MongoDB schema for message templates and email senders 2025-07-25 18:57:53 +08:00
icecheng
69d1007ddf feat(test): add unittest for role management, add coverage report for role management 2025-07-25 16:20:50 +08:00
icecheng
30e6ca72a7 feat(refactor): remove duplicate get_current_user 2025-07-25 10:26:09 +08:00
icecheng
0f7d63f4a2 feat(role_management): add test report for role management 2025-07-22 17:14:30 +08:00
sunhaolou
d01468f89a fix: refractor the length functions and add comments, and address the issues 2025-07-22 13:16:14 +08:00
icecheng
55e0bebbef feat(role_management): update apitest for role management 2025-07-22 12:27:26 +08:00
icecheng
5be8403c75 feat(role_management): update apitest for role management 2025-07-22 12:14:58 +08:00
icecheng
6b6b52a599 feat(role_management): Add apitest for test_assign_roles 2025-07-22 11:52:41 +08:00
icecheng
9dcd27bc8a feat(role_management): Add logic for creating temporary users to apitest. 2025-07-22 11:30:16 +08:00
icecheng
beba0f5fe5 feat(role_management): add api test case for permission api 2025-07-22 10:28:05 +08:00
icecheng
641281066c feat(role_management): Add pytest for auth services, and add api test case for role management 2025-07-21 17:51:08 +08:00
fca4216043 Merge branch 'dev' into haolou_local 2025-07-21 07:37:02 +00:00
sunhaolou
a8f0a714ae refractor: clean up the codes for online services 2025-07-21 15:23:19 +08:00
icecheng
b8be65615b feat(role_management): Add a universal Depends for permission verification. 2025-07-21 15:10:27 +08:00
icecheng
4109018692 feat(role_management): Update the JWT token generation logic to include new fields user_roles and user_permissions in the payload. 2025-07-21 13:09:59 +08:00
sunhaolou
ccc995f599 refractor: a current working version before cleaning up. 2025-07-21 12:50:51 +08:00
icecheng
419e58da0c feat(role_management): add delete role api 2025-07-21 10:53:37 +08:00
icecheng
4f39f888c4 feat(role_management): add delete permission api 2025-07-21 10:33:21 +08:00
icecheng
ca0bfb155f feat(role_management): add assign roles to user api 2025-07-21 10:20:46 +08:00
icecheng
795c1262c6 feat(role_management): add assign permissions to role api 2025-07-21 09:31:37 +08:00
icecheng
2382f0bece feat(role_management): add crud for role and permission 2025-07-18 18:05:57 +08:00
3ce7a7ec76 Merge branch 'dev' into feature/dax/devops-svc 2025-07-15 03:34:15 +00:00
dongli
921633dc04 Implement get_latest_deployment 2025-07-13 11:38:57 -07:00
zhenyus
dd642994d4 Merge branch 'feature/dax/devops-svc' of https://gitea.freeleaps.mathmast.com/freeleaps/freeleaps-service-hub into feature/dax/devops-svc 2025-06-23 16:46:49 +08:00
zhenyus
979fcd298c Add DevOps reconciliation models and integrate into deployment service
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-06-23 16:46:06 +08:00
dongli
2934c647c6 make sha256 optional 2025-06-20 15:09:27 -07:00
dongli
aff12753da Add deployment_app_url 2025-06-19 21:08:08 -07:00
dongli
d660002076 minor 2025-06-16 23:19:09 -07:00
dongli
92b2aba960 Add check_application_logs 2025-06-16 23:18:26 -07:00
dongli
c09ad7f5c9 minor 2025-06-12 17:44:13 -07:00
dongli
6254d13098 Clean up 2025-06-07 13:17:37 -07:00
dongli
7955b5884a Fix some bugs 2025-06-07 13:11:22 -07:00
dongli
b83f5fd606 Depends only works with fastApi methods, so don't use Depends for other methods 2025-06-07 12:34:34 -07:00
dongli
ab7e6728b5 More impl for devops 2025-06-07 11:32:53 -07:00
dongli
308f82740d More impl for devops 2025-06-07 11:32:48 -07:00
dongli
217f33fc17 fix check deployment status bug 2025-05-19 14:55:56 -07:00
dongli
43ec8ec01e Clean up 2025-05-18 23:09:39 -07:00
dongli
bcf13b48f2 Add implementation of devops service 2025-05-18 22:23:44 -07:00
dongli
dd8926b2ec Add template fastapi app, test, README.md, this can be used for future extension 2025-05-11 21:01:11 -07:00
dongli
bf96f8b301 Add template fastapi app, test, README.md, this can be used for future extension 2025-05-11 19:16:00 -07:00
dongli
c4c34e6cd7 Add template fastapi app, test, README.md, this can be used for future extension 2025-05-11 19:15:41 -07:00
dongli
50087c95be Add template fastapi app, this can be used for future extension 2025-05-11 18:44:05 -07:00
dd96819709 fix(cleaner): update document cleaner job 2025-04-26 19:53:44 -07:00
91a893a433 chore(hover_image): adding new hover images in the response body 2025-04-24 00:06:58 -07:00
ecad36ac5c Merge pull request 'feat(log): ensure parent directory exists before opening log file' (#5) from refactor/logging into dev
Reviewed-on: freeleaps/freeleaps-service-hub#5
2025-04-21 05:25:41 +00:00
zhenyus
bb90b26883 feat(log): ensure parent directory exists before opening log file
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-04-21 13:25:05 +08:00
fcc6d22e4d Merge branch 'dev' into refactor/logging 2025-04-21 02:58:52 +00:00
zhenyus
b8f7307a86 refactor(log): refactoring logging for each service for loki
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-04-21 10:55:26 +08:00
b95a818e30 Update payment redirect and scheduler job for deleting document id 2025-04-20 00:05:00 -07:00
Zhenyu Sun
9361f4c545 Merged PR 44: fix: invalid import path for app config
fix: invalid import path for app config

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-03-17 13:54:57 +00:00
zhenyus
4dfbab4d4d fix: invalid import path for app config
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-03-17 21:52:07 +08:00
Zhenyu Sun
8e409aea20 Merged PR 43: build(pip): bump fastapi version to 0.114.0
build(pip): bump fastapi version to 0.114.0

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-03-17 10:17:09 +00:00
zhenyus
a45698c184 build(pip): bump fastapi version to 0.114.0
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-03-17 18:16:41 +08:00
Zhenyu Sun
0f6e4731e3 Merged PR 42: build(pip): freeze missing deps for metrics supports
build(pip): freeze missing deps for metrics supports

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-03-17 09:58:23 +00:00
zhenyus
13c883966e build(pip): freeze missing deps for metrics supports
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-03-17 17:57:13 +08:00