Skip to content

Commit

Permalink
fix: Add missing fields on CozyMetadata for io.cozy.files
Browse files Browse the repository at this point in the history
  • Loading branch information
cballevre committed Nov 15, 2024
1 parent 5039e25 commit 2457269
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/cozy-client/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,20 @@ import { QueryDefinition } from './queries/dsl'
* @property {boolean} [favorite] - Whether the document is marked as favorite
*/

/**
* @typedef {object} UploadedBy
* @property {string} slug - The slug of the application that has made the upload
* @property {string} version - The version number of this application
*/

/**
* @typedef {object} CozyMetadataFile - Extra fields inside cozyMetadata only for io.cozy.files documents
* @property {string} [createdOn] - The instance URL on which the file has created (useful if the file is shared between several cozy instances)
* @property {string} [uploadedAt] - The server date/time of the last upload (when the content was changed)
* @property {string} [uploadedOn] - The instance URL on which the file content was changed the last time
* @property {UploadedBy[]} [uploadedBy] - Information on which app has made the last upload
*/

/**
* @typedef {object} CozyClientDocumentMeta - Meta object as specified by JSON-API (https://jsonapi.org/format/#document-meta)
* @property {string} [rev] - Current revision of the document
Expand Down Expand Up @@ -486,6 +500,7 @@ import { QueryDefinition } from './queries/dsl'
* @property {string} updated_at - Last modification date of the file
* @property {number} size - Size of the file, in bytes
* @property {boolean} trashed - Whether the folder is in the trash
* @property {CozyMetadata & CozyMetadataFile} [cozyMetadata] - Cozy Metadata
* @typedef {CozyClientDocument & FileDocument} IOCozyFile - An io.cozy.files document
*/

Expand Down
35 changes: 35 additions & 0 deletions packages/cozy-client/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,37 @@ export type CozyMetadata = {
*/
favorite?: boolean;
};
export type UploadedBy = {
/**
* - The slug of the application that has made the upload
*/
slug: string;
/**
* - The version number of this application
*/
version: string;
};
/**
* - Extra fields inside cozyMetadata only for io.cozy.files documents
*/
export type CozyMetadataFile = {
/**
* - The instance URL on which the file has created (useful if the file is shared between several cozy instances)
*/
createdOn?: string;
/**
* - The server date/time of the last upload (when the content was changed)
*/
uploadedAt?: string;
/**
* - The instance URL on which the file content was changed the last time
*/
uploadedOn?: string;
/**
* - Information on which app has made the last upload
*/
uploadedBy?: UploadedBy[];
};
/**
* - Meta object as specified by JSON-API (https://jsonapi.org/format/#document-meta)
*/
Expand Down Expand Up @@ -894,6 +925,10 @@ export type FileDocument = {
* - Whether the folder is in the trash
*/
trashed: boolean;
/**
* - Cozy Metadata
*/
cozyMetadata?: CozyMetadata & CozyMetadataFile;
};
/**
* - An io.cozy.files document
Expand Down

0 comments on commit 2457269

Please sign in to comment.