Skip to content

Commit 7674bd7

Browse files
committed
[IMP] fastapi_log_mail: Adapt to log collection
1 parent 70b3ece commit 7674bd7

File tree

13 files changed

+126
-68
lines changed

13 files changed

+126
-68
lines changed

fastapi_log_mail/README.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
===========
2-
Fastapi Log
3-
===========
1+
========================
2+
FastAPI Log notification
3+
========================
44

55
..
66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -28,8 +28,8 @@ Fastapi Log
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
This module allows to send an email when an exception occurs in an
32-
endpoint.
31+
This module allows to create an activity when an exception is logged in
32+
a fastapi endpoint.
3333

3434
**Table of contents**
3535

@@ -39,8 +39,7 @@ endpoint.
3939
Configuration
4040
=============
4141

42-
In any endpoint that has logging enabled, insert an email template in
43-
"Error E-mail Template".
42+
Configure a fastapi endpoint as explained in ``api_log_mail``.
4443

4544
Bug Tracker
4645
===========

fastapi_log_mail/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from . import models

fastapi_log_mail/__manifest__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

44
{
5-
"name": "Fastapi Log",
6-
"version": "16.0.1.0.0",
5+
"name": "FastAPI Log notification",
6+
"version": "16.0.1.1.0",
77
"license": "AGPL-3",
88
"author": "PyTech, Odoo Community Association (OCA)",
99
"maintainers": [
1010
"SirPyTech",
1111
],
1212
"website": "https://github.com/OCA/rest-framework",
13-
"summary": "Email exceptions of Endpoints.",
13+
"summary": "Notify logged exceptions.",
1414
"category": "Tools",
1515
"depends": [
1616
"fastapi_log",
17-
"mail",
17+
"api_log_mail",
1818
],
1919
"data": [
2020
"views/fastapi_endpoint_views.xml",
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2025 Simone Rubino - PyTech
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
template_id_column = openupgrade.get_legacy_name(
10+
"fastapi_log_mail_template_id",
11+
)
12+
openupgrade.logged_query(
13+
env.cr,
14+
"""
15+
UPDATE fastapi_endpoint SET
16+
api_log_mail_exception_template_id=%(template_id_column)s
17+
WHERE %(template_id_column)s IS NOT NULL
18+
"""
19+
% {
20+
"template_id_column": template_id_column,
21+
},
22+
)
23+
openupgrade.logged_query(
24+
env.cr,
25+
"""
26+
ALTER TABLE fastapi_endpoint
27+
DROP COLUMN %(template_id_column)s
28+
"""
29+
% {
30+
"template_id_column": template_id_column,
31+
},
32+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Simone Rubino - PyTech
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
openupgrade.copy_columns(
10+
env.cr,
11+
{
12+
"fastapi_endpoint": [
13+
(
14+
"fastapi_log_mail_template_id",
15+
None,
16+
None,
17+
),
18+
],
19+
},
20+
)

fastapi_log_mail/models/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

fastapi_log_mail/models/api_log.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

fastapi_log_mail/models/fastapi_endpoint.py

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
In any endpoint that has logging enabled, insert an email template in "Error E-mail Template".
1+
Configure a fastapi endpoint as explained in `api_log_mail`.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
This module allows to send an email when an exception occurs in an endpoint.
1+
This module allows to create an activity when an exception is logged in a fastapi endpoint.

0 commit comments

Comments
 (0)