Skip to content

Commit 3ef96c6

Browse files
Merge pull request #6785 from hotosm/tasking-manager-fastapi
Tasking manager fastapi
2 parents 18a19f9 + de017db commit 3ef96c6

File tree

8 files changed

+27
-11
lines changed

8 files changed

+27
-11
lines changed

backend/api/organisations/resources.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def retrieve_organisation_by_slug(
9393
slug: str,
9494
db: Database = Depends(get_db),
9595
omit_managers: bool = Query(
96-
True,
96+
False,
9797
alias="omitManagerList",
9898
description="Omit organization managers list from the response.",
9999
),

backend/api/tasks/actions.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1216,9 +1216,12 @@ async def reset_by_user(
12161216
)
12171217

12181218
if username:
1219-
user = await UserService.get_user_by_username(username, db)
1219+
revert_user = await UserService.get_user_by_username(username, db)
12201220
revert_dto = RevertUserTasksDTO(
1221-
project_id=project_id, user_id=user.id, action_by=user.id, action=action
1221+
project_id=project_id,
1222+
user_id=revert_user.id,
1223+
action_by=user.id,
1224+
action=action,
12221225
)
12231226
except Exception as e:
12241227
logger.error(f"Error validating request: {str(e)}")

backend/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def assemble_db_connection(
121121
TASK_AUTOUNLOCK_AFTER: str = os.getenv("TM_TASK_AUTOUNLOCK_AFTER", "2h")
122122

123123
# Configuration for sending emails
124-
MAIL_SERVER: Optional[str] = os.getenv("TM_SMTP_HOST", None)
124+
MAIL_SERVER: Optional[str] = os.getenv("TM_SMTP_HOST", "smtp.gmail.com")
125125
MAIL_PORT: str = os.getenv("TM_SMTP_PORT", "587")
126126
MAIL_USE_TLS: bool = bool(int(os.getenv("TM_SMTP_USE_TLS", True)))
127127
MAIL_USE_SSL: bool = bool(int(os.getenv("TM_SMTP_USE_SSL", False)))
@@ -265,7 +265,7 @@ def assemble_db_connection(
265265
IMAGE_UPLOAD_API_URL: str = _params.get("IMAGE_UPLOAD_API_URL", None)
266266

267267
# Sentry backend DSN
268-
SENTRY_BACKEND_DSN: str = os.getenv("TM_SENTRY_BACKEND_DSN", None)
268+
SENTRY_BACKEND_DSN: Optional[str] = os.getenv("TM_SENTRY_BACKEND_DSN", None)
269269

270270
# Ohsome Stats Token
271271
OHSOME_STATS_TOKEN: str = os.getenv("OHSOME_STATS_TOKEN", None)

backend/models/postgis/organisation.py

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ async def get_all_organisations(db: Database):
233233
LEFT JOIN organisation_managers om ON o.id = om.organisation_id
234234
LEFT JOIN users u ON om.user_id = u.id
235235
GROUP BY o.id
236+
ORDER BY o.name
236237
"""
237238
result = await db.fetch_all(query)
238239
return result

backend/services/messaging/template_service.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# Set up Jinja2 environment
1010
env = Environment(
1111
loader=FileSystemLoader(os.path.join(os.path.dirname(__file__), "templates")),
12-
autoescape=False,
1312
)
1413

1514

backend/services/organisation_service.py

-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ async def get_organisation_stats(
419419
FROM projects p
420420
WHERE p.organisation_id = :organisation_id
421421
AND p.status = {ProjectStatus.PUBLISHED.value}
422-
)
423422
"""
424423

425424
task_values = {"organisation_id": organisation_id}

docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,16 @@ services:
117117
- --providers.docker=true
118118
networks:
119119
- tm-net
120+
121+
tm-frontend:
122+
image: ghcr.io/hotosm/tasking-manager/frontend:main
123+
build:
124+
context: .
125+
dockerfile: "./scripts/docker/Dockerfile.frontend_development"
126+
env_file:
127+
- tasking-manager.env
128+
labels:
129+
- traefik.http.routers.frontend.rule=Host(`127.0.0.1`) || Host(`localhost`)
130+
- traefik.http.services.frontend.loadbalancer.server.port=3000
131+
networks:
132+
- tm-net

example.env

+5-4
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ POSTGRES_TEST_DB=tasking-manager-test
154154
# Email sending server configuration (optional)
155155
# This is required in order to send out messages.
156156
#
157-
# TM_SMTP_HOST=
158-
# TM_SMTP_PORT=25
159-
# TM_SMTP_USER=
160-
# TM_SMTP_PASSWORD=
157+
TM_SMTP_HOST=smtp.gmail.com
158+
TM_SMTP_PORT=587
159+
TM_SMTP_USER=[email protected]
160+
TM_SMTP_PASSWORD=enter-app-password
161161
# Following two variables can have value of either 0 or 1
162162
# TM_SMTP_USE_TLS=0
163163
# TM_SMTP_USE_SSL=1
@@ -214,3 +214,4 @@ UNDERPASS_URL=https://underpass.hotosm.org
214214
#EXPORT_TOOL_S3_URL=https://foorawdataapi.s3.amazonaws.com
215215
#ENABLE_EXPORT_TOOL=0
216216
PROFILING=False
217+
USE_SENTRY=false

0 commit comments

Comments
 (0)