diff --git a/api/openapi-v2.json b/api/openapi-v2.json
index ebd964217..5a9e09bd5 100644
--- a/api/openapi-v2.json
+++ b/api/openapi-v2.json
@@ -30809,6 +30809,7 @@
},
"project_id": {
"description": "The project id value.",
+ "nullable": true,
"type": "integer"
},
"project_name": {
@@ -30848,7 +30849,6 @@
"created_at",
"description",
"id",
- "project_id",
"start_time_utc",
"user_id",
"workspace_id"
@@ -30861,6 +30861,251 @@
],
"type": "object"
},
+ "GetTimeWorklogDraftsDraftIdResult": {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "additionalProperties": false,
+ "properties": {
+ "created_at": {
+ "description": "The created at value.",
+ "type": "integer"
+ },
+ "customer_builtin_key": {
+ "description": "The customer builtin key value.",
+ "type": "string"
+ },
+ "customer_name": {
+ "description": "The customer name value.",
+ "type": "string"
+ },
+ "date": {
+ "description": "The date value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "description": {
+ "description": "The description value.",
+ "type": "string"
+ },
+ "duration_minutes": {
+ "description": "The duration minutes value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "end_time": {
+ "description": "The end time value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "id": {
+ "description": "The id value.",
+ "type": "integer"
+ },
+ "item_id": {
+ "description": "The item id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "item_title": {
+ "description": "The item title value.",
+ "type": "string"
+ },
+ "project_id": {
+ "description": "The project id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "project_name": {
+ "description": "The project name value.",
+ "type": "string"
+ },
+ "source": {
+ "description": "The source value.",
+ "type": "string"
+ },
+ "source_timer_id": {
+ "description": "The source timer id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "start_time": {
+ "description": "The start time value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "updated_at": {
+ "description": "The updated at value.",
+ "type": "integer"
+ },
+ "user_id": {
+ "description": "The user id value.",
+ "type": "integer"
+ },
+ "version": {
+ "description": "The version value.",
+ "type": "integer"
+ },
+ "workspace_id": {
+ "description": "The workspace id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "workspace_key": {
+ "description": "The workspace key value.",
+ "type": "string"
+ },
+ "workspace_name": {
+ "description": "The workspace name value.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "created_at",
+ "customer_name",
+ "description",
+ "id",
+ "item_title",
+ "project_name",
+ "source",
+ "updated_at",
+ "user_id",
+ "version",
+ "workspace_key",
+ "workspace_name"
+ ],
+ "type": "object"
+ }
+ },
+ "required": [
+ "data"
+ ],
+ "type": "object"
+ },
+ "GetTimeWorklogDraftsResult": {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "items": {
+ "additionalProperties": false,
+ "properties": {
+ "created_at": {
+ "description": "The created at value.",
+ "type": "integer"
+ },
+ "customer_builtin_key": {
+ "description": "The customer builtin key value.",
+ "type": "string"
+ },
+ "customer_name": {
+ "description": "The customer name value.",
+ "type": "string"
+ },
+ "date": {
+ "description": "The date value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "description": {
+ "description": "The description value.",
+ "type": "string"
+ },
+ "duration_minutes": {
+ "description": "The duration minutes value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "end_time": {
+ "description": "The end time value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "id": {
+ "description": "The id value.",
+ "type": "integer"
+ },
+ "item_id": {
+ "description": "The item id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "item_title": {
+ "description": "The item title value.",
+ "type": "string"
+ },
+ "project_id": {
+ "description": "The project id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "project_name": {
+ "description": "The project name value.",
+ "type": "string"
+ },
+ "source": {
+ "description": "The source value.",
+ "type": "string"
+ },
+ "source_timer_id": {
+ "description": "The source timer id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "start_time": {
+ "description": "The start time value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "updated_at": {
+ "description": "The updated at value.",
+ "type": "integer"
+ },
+ "user_id": {
+ "description": "The user id value.",
+ "type": "integer"
+ },
+ "version": {
+ "description": "The version value.",
+ "type": "integer"
+ },
+ "workspace_id": {
+ "description": "The workspace id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "workspace_key": {
+ "description": "The workspace key value.",
+ "type": "string"
+ },
+ "workspace_name": {
+ "description": "The workspace name value.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "created_at",
+ "customer_name",
+ "description",
+ "id",
+ "item_title",
+ "project_name",
+ "source",
+ "updated_at",
+ "user_id",
+ "version",
+ "workspace_key",
+ "workspace_name"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "data"
+ ],
+ "type": "object"
+ },
"GetTimeWorklogsAggregateResult": {
"additionalProperties": false,
"properties": {
@@ -59523,6 +59768,185 @@
],
"type": "object"
},
+ "PatchTimeWorklogDraftsDraftIdPayload": {
+ "additionalProperties": false,
+ "properties": {
+ "date": {
+ "description": "The date value.",
+ "nullable": true,
+ "type": "string"
+ },
+ "description": {
+ "description": "The description value.",
+ "nullable": true,
+ "type": "string"
+ },
+ "duration": {
+ "description": "The duration value.",
+ "nullable": true,
+ "type": "string"
+ },
+ "duration_minutes": {
+ "description": "The duration minutes value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "end_time": {
+ "description": "The end time value.",
+ "nullable": true,
+ "type": "string"
+ },
+ "item_id": {
+ "description": "The item id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "project_id": {
+ "description": "The project id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "start_time": {
+ "description": "The start time value.",
+ "nullable": true,
+ "type": "string"
+ },
+ "timezone": {
+ "description": "The timezone value.",
+ "nullable": true,
+ "type": "string"
+ },
+ "version": {
+ "description": "The version value.",
+ "type": "integer"
+ }
+ },
+ "required": [
+ "version"
+ ],
+ "type": "object"
+ },
+ "PatchTimeWorklogDraftsDraftIdResult": {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "additionalProperties": false,
+ "properties": {
+ "created_at": {
+ "description": "The created at value.",
+ "type": "integer"
+ },
+ "customer_builtin_key": {
+ "description": "The customer builtin key value.",
+ "type": "string"
+ },
+ "customer_name": {
+ "description": "The customer name value.",
+ "type": "string"
+ },
+ "date": {
+ "description": "The date value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "description": {
+ "description": "The description value.",
+ "type": "string"
+ },
+ "duration_minutes": {
+ "description": "The duration minutes value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "end_time": {
+ "description": "The end time value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "id": {
+ "description": "The id value.",
+ "type": "integer"
+ },
+ "item_id": {
+ "description": "The item id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "item_title": {
+ "description": "The item title value.",
+ "type": "string"
+ },
+ "project_id": {
+ "description": "The project id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "project_name": {
+ "description": "The project name value.",
+ "type": "string"
+ },
+ "source": {
+ "description": "The source value.",
+ "type": "string"
+ },
+ "source_timer_id": {
+ "description": "The source timer id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "start_time": {
+ "description": "The start time value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "updated_at": {
+ "description": "The updated at value.",
+ "type": "integer"
+ },
+ "user_id": {
+ "description": "The user id value.",
+ "type": "integer"
+ },
+ "version": {
+ "description": "The version value.",
+ "type": "integer"
+ },
+ "workspace_id": {
+ "description": "The workspace id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "workspace_key": {
+ "description": "The workspace key value.",
+ "type": "string"
+ },
+ "workspace_name": {
+ "description": "The workspace name value.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "created_at",
+ "customer_name",
+ "description",
+ "id",
+ "item_title",
+ "project_name",
+ "source",
+ "updated_at",
+ "user_id",
+ "version",
+ "workspace_key",
+ "workspace_name"
+ ],
+ "type": "object"
+ }
+ },
+ "required": [
+ "data"
+ ],
+ "type": "object"
+ },
"PatchTimeWorklogsWorklogIdPayload": {
"additionalProperties": false,
"properties": {
@@ -89531,16 +89955,36 @@
],
"type": "object"
},
+ "PostTimeTimersActiveStopPayload": {
+ "additionalProperties": false,
+ "properties": {
+ "timer_id": {
+ "description": "The timer id value.",
+ "nullable": true,
+ "type": "integer"
+ }
+ },
+ "type": "object"
+ },
"PostTimeTimersActiveStopResult": {
"additionalProperties": false,
"properties": {
"data": {
"additionalProperties": false,
"properties": {
+ "booked": {
+ "description": "The booked value.",
+ "type": "boolean"
+ },
"description": {
"description": "The description value.",
"type": "string"
},
+ "draft_id": {
+ "description": "The draft id value.",
+ "nullable": true,
+ "type": "integer"
+ },
"duration_minutes": {
"description": "The duration minutes value.",
"type": "integer"
@@ -89557,18 +90001,19 @@
"description": "The timer id value.",
"type": "integer"
},
- "worklog_created": {
- "description": "The worklog created value.",
- "type": "boolean"
+ "worklog_id": {
+ "description": "The worklog id value.",
+ "nullable": true,
+ "type": "integer"
}
},
"required": [
+ "booked",
"description",
"duration_minutes",
"duration_seconds",
"stopped",
- "timer_id",
- "worklog_created"
+ "timer_id"
],
"type": "object"
}
@@ -89592,6 +90037,7 @@
},
"project_id": {
"description": "The project id value.",
+ "nullable": true,
"type": "integer"
},
"workspace_id": {
@@ -89601,7 +90047,6 @@
},
"required": [
"description",
- "project_id",
"workspace_id"
],
"type": "object"
@@ -89647,6 +90092,7 @@
},
"project_id": {
"description": "The project id value.",
+ "nullable": true,
"type": "integer"
},
"project_name": {
@@ -89686,7 +90132,6 @@
"created_at",
"description",
"id",
- "project_id",
"start_time_utc",
"user_id",
"workspace_id"
@@ -89699,6 +90144,202 @@
],
"type": "object"
},
+ "PostTimeWorklogDraftsDraftIdBookPayload": {
+ "additionalProperties": false,
+ "properties": {
+ "date": {
+ "description": "The date value.",
+ "type": "string"
+ },
+ "description": {
+ "description": "The description value.",
+ "type": "string"
+ },
+ "duration": {
+ "description": "The duration value.",
+ "type": "string"
+ },
+ "duration_minutes": {
+ "description": "The duration minutes value.",
+ "type": "integer"
+ },
+ "end_time": {
+ "description": "The end time value.",
+ "type": "string"
+ },
+ "idempotency_key": {
+ "description": "The idempotency key value.",
+ "type": "string"
+ },
+ "item_id": {
+ "description": "The item id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "project_id": {
+ "description": "The project id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "start_time": {
+ "description": "The start time value.",
+ "type": "string"
+ },
+ "timezone": {
+ "description": "The timezone value.",
+ "type": "string"
+ },
+ "version": {
+ "description": "The version value.",
+ "type": "integer"
+ }
+ },
+ "required": [
+ "date",
+ "description",
+ "duration",
+ "duration_minutes",
+ "end_time",
+ "idempotency_key",
+ "start_time",
+ "timezone",
+ "version"
+ ],
+ "type": "object"
+ },
+ "PostTimeWorklogDraftsDraftIdBookResult": {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "additionalProperties": false,
+ "properties": {
+ "created_at": {
+ "description": "The created at value.",
+ "type": "integer"
+ },
+ "customer_builtin_key": {
+ "description": "The customer builtin key value.",
+ "type": "string"
+ },
+ "customer_id": {
+ "description": "The customer id value.",
+ "type": "integer"
+ },
+ "customer_name": {
+ "description": "The customer name value.",
+ "type": "string"
+ },
+ "date": {
+ "description": "The date value.",
+ "type": "integer"
+ },
+ "description": {
+ "description": "The description value.",
+ "type": "string"
+ },
+ "duration_minutes": {
+ "description": "The duration minutes value.",
+ "type": "integer"
+ },
+ "end_time": {
+ "description": "The end time value.",
+ "type": "integer"
+ },
+ "id": {
+ "description": "The id value.",
+ "type": "integer"
+ },
+ "item_id": {
+ "description": "The item id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "item_title": {
+ "description": "The item title value.",
+ "type": "string"
+ },
+ "project_id": {
+ "description": "The project id value.",
+ "type": "integer"
+ },
+ "project_max_hours": {
+ "description": "The project max hours value.",
+ "nullable": true,
+ "type": "number"
+ },
+ "project_name": {
+ "description": "The project name value.",
+ "type": "string"
+ },
+ "project_total_hours": {
+ "description": "The project total hours value.",
+ "nullable": true,
+ "type": "number"
+ },
+ "start_time": {
+ "description": "The start time value.",
+ "type": "integer"
+ },
+ "updated_at": {
+ "description": "The updated at value.",
+ "type": "integer"
+ },
+ "user_id": {
+ "description": "The user id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "user_name": {
+ "description": "The user name value.",
+ "type": "string"
+ },
+ "warnings": {
+ "description": "The warnings value.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "workspace_id": {
+ "description": "The workspace id value.",
+ "nullable": true,
+ "type": "integer"
+ },
+ "workspace_item_number": {
+ "description": "The workspace item number value.",
+ "type": "integer"
+ },
+ "workspace_key": {
+ "description": "The workspace key value.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "created_at",
+ "customer_id",
+ "customer_name",
+ "date",
+ "description",
+ "duration_minutes",
+ "end_time",
+ "id",
+ "item_title",
+ "project_id",
+ "project_name",
+ "start_time",
+ "updated_at",
+ "user_name",
+ "workspace_item_number",
+ "workspace_key"
+ ],
+ "type": "object"
+ }
+ },
+ "required": [
+ "data"
+ ],
+ "type": "object"
+ },
"PostTimeWorklogsPayload": {
"additionalProperties": false,
"properties": {
@@ -120913,6 +121554,16 @@
"description": "Stop timer. The server validates resource ownership and command preconditions before persisting changes. Unknown JSON fields are rejected when the operation accepts a body.",
"operationId": "postTimeTimersActiveStop",
"parameters": [],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PostTimeTimersActiveStopPayload"
+ }
+ }
+ },
+ "required": true
+ },
"responses": {
"200": {
"content": {
@@ -120924,6 +121575,9 @@
},
"description": "Stop timer response."
},
+ "400": {
+ "$ref": "#/components/responses/InvalidRequestError"
+ },
"401": {
"$ref": "#/components/responses/AuthenticationError"
},
@@ -120933,6 +121587,12 @@
"404": {
"$ref": "#/components/responses/NotFoundError"
},
+ "413": {
+ "$ref": "#/components/responses/PayloadTooLargeError"
+ },
+ "415": {
+ "$ref": "#/components/responses/UnsupportedMediaTypeError"
+ },
"429": {
"$ref": "#/components/responses/RateLimitError"
},
@@ -120954,6 +121614,304 @@
]
}
},
+ "/time/worklog-drafts": {
+ "get": {
+ "description": "List draft worklogs. Results include only resources visible to the authenticated caller; collections use their documented stable order and bounds.",
+ "operationId": "getTimeWorklogDrafts",
+ "parameters": [],
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetTimeWorklogDraftsResult"
+ }
+ }
+ },
+ "description": "List draft worklogs response."
+ },
+ "401": {
+ "$ref": "#/components/responses/AuthenticationError"
+ },
+ "403": {
+ "$ref": "#/components/responses/PermissionError"
+ },
+ "429": {
+ "$ref": "#/components/responses/RateLimitError"
+ },
+ "500": {
+ "$ref": "#/components/responses/InternalError"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "summary": "List draft worklogs",
+ "tags": [
+ "Time tracking"
+ ],
+ "x-required-scopes": [
+ "time:read"
+ ]
+ }
+ },
+ "/time/worklog-drafts/{draft_id}": {
+ "delete": {
+ "description": "Delete a draft worklog. The server verifies resource ownership and deletion preconditions before removing the resource.",
+ "operationId": "deleteTimeWorklogDraftsDraftId",
+ "parameters": [
+ {
+ "description": "The draft worklog identifier.",
+ "in": "path",
+ "name": "draft_id",
+ "required": true,
+ "schema": {
+ "minimum": 1,
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Request completed successfully with no response body."
+ },
+ "401": {
+ "$ref": "#/components/responses/AuthenticationError"
+ },
+ "403": {
+ "$ref": "#/components/responses/PermissionError"
+ },
+ "404": {
+ "$ref": "#/components/responses/NotFoundError"
+ },
+ "429": {
+ "$ref": "#/components/responses/RateLimitError"
+ },
+ "500": {
+ "$ref": "#/components/responses/InternalError"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "summary": "Delete a draft worklog",
+ "tags": [
+ "Time tracking"
+ ],
+ "x-required-scopes": [
+ "time:write"
+ ]
+ },
+ "get": {
+ "description": "Get a draft worklog. Results include only resources visible to the authenticated caller; collections use their documented stable order and bounds.",
+ "operationId": "getTimeWorklogDraftsDraftId",
+ "parameters": [
+ {
+ "description": "The draft worklog identifier.",
+ "in": "path",
+ "name": "draft_id",
+ "required": true,
+ "schema": {
+ "minimum": 1,
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetTimeWorklogDraftsDraftIdResult"
+ }
+ }
+ },
+ "description": "Get a draft worklog response."
+ },
+ "401": {
+ "$ref": "#/components/responses/AuthenticationError"
+ },
+ "403": {
+ "$ref": "#/components/responses/PermissionError"
+ },
+ "404": {
+ "$ref": "#/components/responses/NotFoundError"
+ },
+ "429": {
+ "$ref": "#/components/responses/RateLimitError"
+ },
+ "500": {
+ "$ref": "#/components/responses/InternalError"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "summary": "Get a draft worklog",
+ "tags": [
+ "Time tracking"
+ ],
+ "x-required-scopes": [
+ "time:read"
+ ]
+ },
+ "patch": {
+ "description": "Update a draft worklog. The operation uses JSON Merge Patch: omitted fields remain unchanged and documented nullable fields accept null. Unknown fields are rejected.",
+ "operationId": "patchTimeWorklogDraftsDraftId",
+ "parameters": [
+ {
+ "description": "The draft worklog identifier.",
+ "in": "path",
+ "name": "draft_id",
+ "required": true,
+ "schema": {
+ "minimum": 1,
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/merge-patch+json": {
+ "schema": {
+ "$ref": "#/components/schemas/PatchTimeWorklogDraftsDraftIdPayload"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PatchTimeWorklogDraftsDraftIdResult"
+ }
+ }
+ },
+ "description": "Update a draft worklog response."
+ },
+ "400": {
+ "$ref": "#/components/responses/InvalidRequestError"
+ },
+ "401": {
+ "$ref": "#/components/responses/AuthenticationError"
+ },
+ "403": {
+ "$ref": "#/components/responses/PermissionError"
+ },
+ "404": {
+ "$ref": "#/components/responses/NotFoundError"
+ },
+ "413": {
+ "$ref": "#/components/responses/PayloadTooLargeError"
+ },
+ "415": {
+ "$ref": "#/components/responses/UnsupportedMediaTypeError"
+ },
+ "429": {
+ "$ref": "#/components/responses/RateLimitError"
+ },
+ "500": {
+ "$ref": "#/components/responses/InternalError"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "summary": "Update a draft worklog",
+ "tags": [
+ "Time tracking"
+ ],
+ "x-required-scopes": [
+ "time:write"
+ ]
+ }
+ },
+ "/time/worklog-drafts/{draft_id}/book": {
+ "post": {
+ "description": "Book a draft worklog. The server validates resource ownership and command preconditions before persisting changes. Unknown JSON fields are rejected when the operation accepts a body.",
+ "operationId": "postTimeWorklogDraftsDraftIdBook",
+ "parameters": [
+ {
+ "description": "The draft worklog identifier.",
+ "in": "path",
+ "name": "draft_id",
+ "required": true,
+ "schema": {
+ "minimum": 1,
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PostTimeWorklogDraftsDraftIdBookPayload"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PostTimeWorklogDraftsDraftIdBookResult"
+ }
+ }
+ },
+ "description": "Book a draft worklog response."
+ },
+ "400": {
+ "$ref": "#/components/responses/InvalidRequestError"
+ },
+ "401": {
+ "$ref": "#/components/responses/AuthenticationError"
+ },
+ "403": {
+ "$ref": "#/components/responses/PermissionError"
+ },
+ "404": {
+ "$ref": "#/components/responses/NotFoundError"
+ },
+ "413": {
+ "$ref": "#/components/responses/PayloadTooLargeError"
+ },
+ "415": {
+ "$ref": "#/components/responses/UnsupportedMediaTypeError"
+ },
+ "429": {
+ "$ref": "#/components/responses/RateLimitError"
+ },
+ "500": {
+ "$ref": "#/components/responses/InternalError"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "summary": "Book a draft worklog",
+ "tags": [
+ "Time tracking"
+ ],
+ "x-required-scopes": [
+ "time:write"
+ ]
+ }
+ },
"/time/worklogs": {
"get": {
"description": "List worklogs. Results include only resources visible to the authenticated caller; collections use their documented stable order and bounds.",
diff --git a/frontend/src/lib/api/time.js b/frontend/src/lib/api/time.js
index 057073d9a..82e114c44 100644
--- a/frontend/src/lib/api/time.js
+++ b/frontend/src/lib/api/time.js
@@ -90,6 +90,25 @@ export const time = {
getByItem: (itemId, requestOptions = {}) =>
fetchAllV2Pages(`/items/${itemId}/worklogs`, requestOptions),
},
+
+ // Draft worklogs: incomplete, user-owned entries produced when a timer stops
+ // without booking information. Booked entries leave this list.
+ worklogDrafts: {
+ getAll: (requestOptions = {}) => fetchV2Data('/time/worklog-drafts', requestOptions),
+ get: (id, requestOptions = {}) => fetchV2Data(`/time/worklog-drafts/${id}`, requestOptions),
+ update: (id, data) =>
+ fetchV2Data(`/time/worklog-drafts/${id}`, {
+ method: 'PATCH',
+ headers: { 'Content-Type': 'application/merge-patch+json' },
+ body: JSON.stringify(data),
+ }),
+ book: (id, data) =>
+ fetchV2Data(`/time/worklog-drafts/${id}/book`, {
+ method: 'POST',
+ body: JSON.stringify(data),
+ }),
+ delete: (id) => fetchV2Data(`/time/worklog-drafts/${id}`, { method: 'DELETE' }),
+ },
};
export const timer = {
@@ -99,8 +118,9 @@ export const timer = {
body: JSON.stringify(data),
}),
getActive: () => fetchV2Data('/time/timers/active'),
- stop: () =>
+ stop: (timerId = null) =>
fetchV2Data('/time/timers/active/stop', {
method: 'POST',
+ body: JSON.stringify(timerId ? { timer_id: timerId } : {}),
}),
};
diff --git a/frontend/src/lib/commands/providers/timeProvider.js b/frontend/src/lib/commands/providers/timeProvider.js
index 91bd28693..c81206a94 100644
--- a/frontend/src/lib/commands/providers/timeProvider.js
+++ b/frontend/src/lib/commands/providers/timeProvider.js
@@ -1,4 +1,5 @@
-import { navigate } from '../../router.js';
+import { stopTimerAndReview } from '../../features/time/stopTimerAndReview.js';
+import { timeLogStore } from '../../stores/timeLogStore.svelte.js';
import { timerStore } from '../../stores/timerStore.svelte.js';
import { errorToast, infoToast, warningToast } from '../../stores/toasts.svelte.js';
import { BUCKET } from '../buckets.js';
@@ -40,10 +41,7 @@ export function timeProvider(ctx) {
bucket: BUCKET.MODULE_ACTIONS,
keywords: ['log', 'time', 'entry', 'hours', 'work', 'track', 'add'],
execute: () => {
- navigate('/time');
- setTimeout(() => {
- window.dispatchEvent(new CustomEvent('focus-time-entry-form'));
- }, 100);
+ timeLogStore.open();
},
}),
];
@@ -76,7 +74,7 @@ export function timeProvider(ctx) {
execute: async () => {
if (timerStore.canStop) {
try {
- await timerStore.stop();
+ await stopTimerAndReview(timerStore, timeLogStore);
} catch (err) {
errorToast(t('dialogs.alerts.stopTimerFailed', { error: err.message }));
}
diff --git a/frontend/src/lib/dialogs/TimeLogModal.svelte b/frontend/src/lib/dialogs/TimeLogModal.svelte
index 9a4821499..844c5dc6e 100644
--- a/frontend/src/lib/dialogs/TimeLogModal.svelte
+++ b/frontend/src/lib/dialogs/TimeLogModal.svelte
@@ -35,8 +35,10 @@
workItems = [],
workspaces = [],
editingWorklog = null,
+ draft = null,
onsave = () => {},
- oncancel = () => {}
+ oncancel = () => {},
+ ondiscard = null
} = $props();
// One explicit timezone populates and interprets every form control, so
@@ -55,18 +57,22 @@
}
const durationSync = createDurationSync(); // Guarded updates to avoid recursive time sync
+ // Worklogs and drafts share the same field names (absolute unix timestamps
+ // plus duration_minutes), so one source record drives the editable form.
+ const sourceRecord = editingWorklog ?? draft ?? null;
+ const isDraft = $derived(!!draft && !editingWorklog);
// Snapshot props for the editable form; updates are then user-driven, not prop-driven.
// svelte-ignore state_referenced_locally
let formData = $state({
- project_id: editingWorklog?.project_id ?? defaultProjectId,
- item_id: editingWorklog?.item_id ?? defaultItemId,
- description: editingWorklog?.description ?? '',
- date: editingWorklog
- ? dateKeyInZone(editingWorklog.start_time, formTimezone)
+ project_id: sourceRecord?.project_id ?? defaultProjectId,
+ item_id: sourceRecord?.item_id ?? defaultItemId,
+ description: sourceRecord?.description ?? '',
+ date: sourceRecord
+ ? dateKeyInZone(sourceRecord.date ?? sourceRecord.start_time, formTimezone)
: (defaultDate ?? dateKeyInZone(Date.now() / 1000, formTimezone)),
- start_time: editingWorklog ? formatClockInZone(editingWorklog.start_time, formTimezone) : (defaultStartTime ?? ''),
- end_time: editingWorklog ? formatClockInZone(editingWorklog.end_time, formTimezone) : '',
- duration: editingWorklog ? formatDurationFromMinutes(editingWorklog.duration_minutes) : ''
+ start_time: sourceRecord?.start_time != null ? formatClockInZone(sourceRecord.start_time, formTimezone) : (defaultStartTime ?? ''),
+ end_time: sourceRecord?.end_time != null ? formatClockInZone(sourceRecord.end_time, formTimezone) : '',
+ duration: sourceRecord?.duration_minutes != null ? formatDurationFromMinutes(sourceRecord.duration_minutes) : ''
});
// Time fields the form was opened with; an edit that leaves them untouched
@@ -244,7 +250,7 @@
>
{#snippet children(submitHint)}
-