Skip to main content

Function: upsertManualCsvEntries()

upsertManualCsvEntries(entries, companyId): Promise<ManualImportResult>

Defined in: src/server/services/timesheet.ts:22

Upsert generic-CSV hours as manual time_entries. Maps email → contractor (company-scoped) and attaches to the contractor's active assignment (latest effective). This path is for OUTSOURCED contractors only — in_house_admin hours come from Hubstaff, so those rows are skipped.

Mirrors upsertSyncedEntries but writes source = 'manual'. Unlike the Hubstaff sync (which also protects existing manual rows from being clobbered), an admin CSV is an intentional correction, so it overwrites existing manual/submitted rows — but still never touches locked/approved entries, and never downgrades a pending_approval status. Idempotent on (contractor, assignment, date). DB write failures are counted separately.

Parameters

entries

ManualHoursEntry[]

companyId

string

Returns

Promise<ManualImportResult>