Add backup router registration and fix updateto.sh with sudo
This commit is contained in:
parent
e10bb20e77
commit
60614ae298
4
main.py
4
main.py
@ -47,6 +47,8 @@ from app.emails.backend import router as emails_api
|
|||||||
from app.emails.frontend import views as emails_views
|
from app.emails.frontend import views as emails_views
|
||||||
from app.settings.backend import router as settings_api
|
from app.settings.backend import router as settings_api
|
||||||
from app.settings.backend import views as settings_views
|
from app.settings.backend import views as settings_views
|
||||||
|
from app.backups.backend import router as backups_api
|
||||||
|
from app.backups.frontend import views as backups_views
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
@ -117,6 +119,7 @@ app.include_router(timetracking_api, prefix="/api/v1", tags=["Time Tracking"])
|
|||||||
app.include_router(tags_api.router, prefix="/api/v1", tags=["Tags"])
|
app.include_router(tags_api.router, prefix="/api/v1", tags=["Tags"])
|
||||||
app.include_router(emails_api.router, prefix="/api/v1", tags=["Emails"])
|
app.include_router(emails_api.router, prefix="/api/v1", tags=["Emails"])
|
||||||
app.include_router(settings_api.router, prefix="/api/v1", tags=["Settings"])
|
app.include_router(settings_api.router, prefix="/api/v1", tags=["Settings"])
|
||||||
|
app.include_router(backups_api.router, prefix="/api/v1", tags=["Backups"])
|
||||||
|
|
||||||
# Frontend Routers
|
# Frontend Routers
|
||||||
app.include_router(dashboard_views.router, tags=["Frontend"])
|
app.include_router(dashboard_views.router, tags=["Frontend"])
|
||||||
@ -130,6 +133,7 @@ app.include_router(contacts_views.router, tags=["Frontend"])
|
|||||||
app.include_router(tags_views.router, tags=["Frontend"])
|
app.include_router(tags_views.router, tags=["Frontend"])
|
||||||
app.include_router(settings_views.router, tags=["Frontend"])
|
app.include_router(settings_views.router, tags=["Frontend"])
|
||||||
app.include_router(emails_views.router, tags=["Frontend"])
|
app.include_router(emails_views.router, tags=["Frontend"])
|
||||||
|
app.include_router(backups_views.router, tags=["Frontend"])
|
||||||
|
|
||||||
# Serve static files (UI)
|
# Serve static files (UI)
|
||||||
app.mount("/static", StaticFiles(directory="static", html=True), name="static")
|
app.mount("/static", StaticFiles(directory="static", html=True), name="static")
|
||||||
|
|||||||
39
migrations/024_fix_timetracking_views.sql
Normal file
39
migrations/024_fix_timetracking_views.sql
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
-- Fix timetracking views to show ALL timelogs regardless of cf_timelog_invoiced status
|
||||||
|
-- Issue: cf_timelog_invoiced field might not exist or have different values in vTiger
|
||||||
|
-- Solution: Remove the invoice status filter from views
|
||||||
|
|
||||||
|
-- Oversigt over godkendelsesstatus pr. kunde (FIXED - no invoice filter)
|
||||||
|
CREATE OR REPLACE VIEW tmodule_approval_stats AS
|
||||||
|
SELECT
|
||||||
|
c.id AS customer_id,
|
||||||
|
c.name AS customer_name,
|
||||||
|
c.vtiger_id AS customer_vtiger_id,
|
||||||
|
c.uses_time_card AS uses_time_card,
|
||||||
|
COUNT(t.id) FILTER (WHERE t.billable = true) AS total_entries,
|
||||||
|
COUNT(t.id) FILTER (WHERE t.billable = true AND t.status = 'pending') AS pending_count,
|
||||||
|
COUNT(t.id) FILTER (WHERE t.billable = true AND t.status = 'approved') AS approved_count,
|
||||||
|
COUNT(t.id) FILTER (WHERE t.billable = true AND t.status = 'rejected') AS rejected_count,
|
||||||
|
COUNT(t.id) FILTER (WHERE t.billable = true AND t.status = 'billed') AS billed_count,
|
||||||
|
SUM(t.original_hours) FILTER (WHERE t.billable = true) AS total_original_hours,
|
||||||
|
SUM(t.approved_hours) FILTER (WHERE t.billable = true AND t.status = 'approved') AS total_approved_hours,
|
||||||
|
MAX(t.worked_date) FILTER (WHERE t.billable = true) AS latest_work_date,
|
||||||
|
MAX(t.last_synced_at) FILTER (WHERE t.billable = true) AS last_sync
|
||||||
|
FROM tmodule_customers c
|
||||||
|
LEFT JOIN tmodule_times t ON c.id = t.customer_id
|
||||||
|
GROUP BY c.id, c.name, c.vtiger_id, c.uses_time_card;
|
||||||
|
|
||||||
|
-- Næste tid der skal godkendes (FIXED - no invoice filter)
|
||||||
|
CREATE OR REPLACE VIEW tmodule_next_pending AS
|
||||||
|
SELECT
|
||||||
|
t.*,
|
||||||
|
COALESCE(c.vtiger_data->>'case_no', c.title)::VARCHAR(500) AS case_title,
|
||||||
|
c.status AS case_status,
|
||||||
|
c.vtiger_id AS case_vtiger_id,
|
||||||
|
cust.name AS customer_name,
|
||||||
|
cust.hourly_rate AS customer_rate
|
||||||
|
FROM tmodule_times t
|
||||||
|
JOIN tmodule_cases c ON t.case_id = c.id
|
||||||
|
JOIN tmodule_customers cust ON t.customer_id = cust.id
|
||||||
|
WHERE t.status = 'pending'
|
||||||
|
AND t.billable = true -- Only billable timelogs
|
||||||
|
ORDER BY cust.name, c.title, t.worked_date;
|
||||||
Loading…
Reference in New Issue
Block a user