Skip to content

Commit

Permalink
[content-nodes] Add a log and update the doc for lastUpdatedAt (#9969)
Browse files Browse the repository at this point in the history
* update the documentation with mention of the timestamp

* update the swaggerfile with mention of the timestamp

* add a log on user-set timestamps

* log only if the timestamp is set, add the workspace ID and dataSourceId

* fit wording in endpoint summary
  • Loading branch information
aubin-tchoi authored Jan 15, 2025
1 parent 1e2d252 commit 3ab636d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const config = {
* description: 'Reserved for internal use, should not be set. Document and ancestor ids, with the following convention: parents[0] === documentId, parents[1] === parent_id, and then ancestors ids in order.'
* timestamp:
* type: number
* description: Unix timestamp (in seconds) for the document (e.g. 1698225000). Can be null or omitted.
* description: Reserved for internal use, should not be set. Unix timestamp (in seconds) of the time the document was last updated (e.g. 1698225000).
* light_document_output:
* type: boolean
* description: If true, a lightweight version of the document will be returned in the response (excluding the text, chunks and vectors). Defaults to false.
Expand Down Expand Up @@ -388,6 +388,19 @@ async function handler(
});
}

// TODO(content-node): get rid of this once the use of timestamp columns in core has been rationalized
if (!auth.isSystemKey() && r.data.timestamp) {
logger.info(
{
workspaceId: owner.id,
dataSourceId: dataSource.sId,
timestamp: r.data.timestamp,
currentDate: Date.now(),
},
"[ContentNode] User-set timestamp."
);
}

let sourceUrl: string | null = null;
if (r.data.source_url) {
const { valid: isSourceUrlValid, standardized: standardizedSourceUrl } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ import { apiError } from "@app/logger/withlogging";
* description: Description of the table
* timestamp:
* type: number
* description: Timestamp of the table
* description: Reserved for internal use, should not be set. Unix timestamp (in seconds) of the time the document was last updated (e.g. 1698225000).
* tags:
* type: array
* items:
Expand Down Expand Up @@ -308,6 +308,18 @@ async function handler(
mimeType = r.data.mime_type;
title = r.data.title;
} else {
// TODO(content-node): get rid of this once the use of timestamp columns in core has been rationalized
if (r.data.timestamp) {
logger.info(
{
workspaceId: owner.id,
dataSourceId: dataSource.sId,
timestamp: r.data.timestamp,
currentDate: Date.now(),
},
"[ContentNode] User-set timestamp."
);
}
// If the request is from a regular API key, the request must not provide mimeType.
if (r.data.mime_type) {
return apiError(req, res, {
Expand Down
2 changes: 1 addition & 1 deletion front/pages/api/v1/w/[wId]/spaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type GetSpacesResponseBody =
* @swagger
* /api/v1/w/{wId}/spaces:
* get:
* summary: List Spaces accessible.
* summary: List available spaces.
* description: Retrieves a list of accessible spaces for the authenticated workspace.
* tags:
* - Spaces
Expand Down
6 changes: 3 additions & 3 deletions front/public/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@
},
"timestamp": {
"type": "number",
"description": "Unix timestamp (in seconds) for the document (e.g. 1698225000). Can be null or omitted."
"description": "Reserved for internal use, should not be set. Unix timestamp (in seconds) of the time the document was last updated (e.g. 1698225000)."
},
"light_document_output": {
"type": "boolean",
Expand Down Expand Up @@ -3185,7 +3185,7 @@
},
"timestamp": {
"type": "number",
"description": "Timestamp of the table"
"description": "Reserved for internal use, should not be set. Unix timestamp (in seconds) of the time the document was last updated (e.g. 1698225000)."
},
"tags": {
"type": "array",
Expand Down Expand Up @@ -3296,7 +3296,7 @@
},
"/api/v1/w/{wId}/spaces": {
"get": {
"summary": "List Spaces accessible.",
"summary": "List available spaces.",
"description": "Retrieves a list of accessible spaces for the authenticated workspace.",
"tags": [
"Spaces"
Expand Down

0 comments on commit 3ab636d

Please sign in to comment.