From d6ece752145eab9f895401b4b09e1641b52eda19 Mon Sep 17 00:00:00 2001 From: chime3 Date: Tue, 19 Nov 2024 14:11:24 -0700 Subject: [PATCH 1/5] feat: added history schema --- social/history/v0.1.0/schema.json | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 social/history/v0.1.0/schema.json diff --git a/social/history/v0.1.0/schema.json b/social/history/v0.1.0/schema.json new file mode 100644 index 0000000..f3dcc2b --- /dev/null +++ b/social/history/v0.1.0/schema.json @@ -0,0 +1,67 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://common.schemas.verida.io/social/history/v0.1.0/schema.json", + "title": "History", + "titlePlural": "Histories", + "description": "General history of activities such as listening, watching, browsing, etc.", + "type": "object", + "appearance": { + "style": { + "color": "#4A90E2", + "icon": "./icon.svg" + } + }, + "database": { + "name": "social_history", + "indexes": { + "activityType": [ + "activityType" + ], + "source": ["sourceApplication", "sourceId"] + } + }, + "layouts": { + "create": [ + "timestamp", + "activityType" + ], + "view": [ + "timestamp", + "activityType", + "name", + "summary", + "url", + "sourceApplication", + "sourceId" + ] + }, + "allOf": [ + { + "$ref": "https://core.schemas.verida.io/base/v0.1.0/schema.json" + }, + { + "properties": { + "timestamp": { + "title": "Timestamp", + "description": "When the activity occurred", + "type": "string", + "format": "date-time" + }, + "activityType": { + "title": "Activity Type", + "description": "Type of activity (e.g., listening, watching, browsing)", + "type": "string", + "enum": ["listening", "watching", "browsing", "reading"] + }, + "url": { + "title": "URL", + "description": "The link of source information" + } + }, + "required": [ + "timestamp", + "activityType" + ] + } + ] +} From 92d539f6db2cde8396b0b0b5450df53b85308811 Mon Sep 17 00:00:00 2001 From: chime3 Date: Tue, 19 Nov 2024 15:38:18 -0700 Subject: [PATCH 2/5] feat: added playlist schema --- social/playlist/v0.1.0/schema.json | 117 +++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 social/playlist/v0.1.0/schema.json diff --git a/social/playlist/v0.1.0/schema.json b/social/playlist/v0.1.0/schema.json new file mode 100644 index 0000000..2298474 --- /dev/null +++ b/social/playlist/v0.1.0/schema.json @@ -0,0 +1,117 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://common.schemas.verida.io/social/playlist/v0.1.0/schema.json", + "title": "Playlist", + "titlePlural": "Playlists", + "description": "A generic schema for playlists from platforms like Spotify, YouTube, etc.", + "type": "object", + "appearance": { + "style": { + "color": "#1DB954", + "icon": "./icon.svg" + } + }, + "database": { + "name": "social_playlist", + "indexes": { + "name": ["name"], + "source": ["sourceApplication", "sourceId"] + } + }, + "layouts": { + "create": [ + "name" + ], + "view": [ + "name", + "tracks" + ] + }, + "$defs": { + "person": { + "type": "object", + "title": "Person", + "description": "Schema representing a person", + "properties": { + "email": { + "type": "string", + "format": "email", + "description": "Email address of the person" + }, + "displayName": { + "type": "string", + "description": "Display name of the person" + } + }, + "required": ["displayName"] + }, + "track": { + "type": "object", + "title": "Track", + "description": "Schema representing a track or video in the playlist", + "properties": { + "id": { + "title": "Track ID", + "description": "Unique identifier for the track/video", + "type": "string" + }, + "title": { + "title": "Title", + "description": "Title of the track/video", + "type": "string" + }, + "artist": { + "title": "Artist/Creator", + "description": "Name of the artist or content creator", + "type": "string" + }, + "album": { + "title": "Album", + "description": "Album name (if applicable, e.g., for Spotify)", + "type": "string" + }, + "thumbnail": { + "title": "Thumbnail", + "description": "URL of the thumbnail image", + "type": "string", + "format": "uri" + }, + "duration": { + "title": "Duration", + "description": "Duration of the track/video in milliseconds", + "type": "integer" + }, + "url": { + "title": "URL", + "description": "Direct URL to the track/video", + "type": "string", + "format": "uri" + } + }, + "required": ["id", "title"] + } + }, + "allOf": [ + { + "$ref": "https://core.schemas.verida.io/base/v0.1.0/schema.json" + }, + { + "properties": { + "owner": { + "$ref": "#/$defs/person" + }, + "tracks": { + "type": "array", + "title": "Tracks", + "description": "Array of track or video items in the playlist", + "items": { + "$ref": "#/$defs/track" + } + } + }, + "required": [ + "name" + ] + } + ] +} From 15f58cb71b3defda5bc7b48f74c87ac74ec9db99 Mon Sep 17 00:00:00 2001 From: chime3 Date: Sun, 24 Nov 2024 17:03:36 -0700 Subject: [PATCH 3/5] feat: added type field in playlist --- {social => media}/playlist/v0.1.0/schema.json | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) rename {social => media}/playlist/v0.1.0/schema.json (83%) diff --git a/social/playlist/v0.1.0/schema.json b/media/playlist/v0.1.0/schema.json similarity index 83% rename from social/playlist/v0.1.0/schema.json rename to media/playlist/v0.1.0/schema.json index 2298474..44acded 100644 --- a/social/playlist/v0.1.0/schema.json +++ b/media/playlist/v0.1.0/schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://common.schemas.verida.io/social/playlist/v0.1.0/schema.json", + "$id": "https://common.schemas.verida.io/media/playlist/v0.1.0/schema.json", "title": "Playlist", "titlePlural": "Playlists", "description": "A generic schema for playlists from platforms like Spotify, YouTube, etc.", @@ -12,22 +12,30 @@ } }, "database": { - "name": "social_playlist", + "name": "media_playlist", "indexes": { - "name": ["name"], + "name": ["name"], "source": ["sourceApplication", "sourceId"] } }, "layouts": { "create": [ - "name" + "name", + "type" ], "view": [ - "name", - "tracks" + "name", + "type", + "tracks" ] }, "$defs": { + "type": { + "type": "string", + "enum": ["audio", "video"], + "title": "Type", + "description": "Type of the playlist or track, either audio or video" + }, "person": { "type": "object", "title": "Person", @@ -86,6 +94,9 @@ "description": "Direct URL to the track/video", "type": "string", "format": "uri" + }, + "type": { + "$ref": "#/$defs/type" } }, "required": ["id", "title"] @@ -97,6 +108,9 @@ }, { "properties": { + "type": { + "$ref": "#/$defs/type" + }, "owner": { "$ref": "#/$defs/person" }, @@ -109,9 +123,7 @@ } } }, - "required": [ - "name" - ] + "required": ["name", "type"] } ] } From a1a38bfd7785d49a61b5dbd948e9d7fb8089e989 Mon Sep 17 00:00:00 2001 From: chime3 Date: Sun, 24 Nov 2024 17:22:53 -0700 Subject: [PATCH 4/5] feat: added duration field in history schema --- .../history/v0.1.0/schema.json | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) rename {social => activity}/history/v0.1.0/schema.json (77%) diff --git a/social/history/v0.1.0/schema.json b/activity/history/v0.1.0/schema.json similarity index 77% rename from social/history/v0.1.0/schema.json rename to activity/history/v0.1.0/schema.json index f3dcc2b..0678c12 100644 --- a/social/history/v0.1.0/schema.json +++ b/activity/history/v0.1.0/schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://common.schemas.verida.io/social/history/v0.1.0/schema.json", + "$id": "https://common.schemas.verida.io/activity/history/v0.1.0/schema.json", "title": "History", "titlePlural": "Histories", "description": "General history of activities such as listening, watching, browsing, etc.", @@ -12,23 +12,23 @@ } }, "database": { - "name": "social_history", + "name": "activity_history", "indexes": { - "activityType": [ - "activityType" - ], + "name": ["name", "activityType", "timestamp"], + "insertedAt": ["insertedAt", "timestamp"], "source": ["sourceApplication", "sourceId"] } }, "layouts": { "create": [ + "name", "timestamp", "activityType" ], "view": [ + "name", "timestamp", "activityType", - "name", "summary", "url", "sourceApplication", @@ -56,9 +56,16 @@ "url": { "title": "URL", "description": "The link of source information" + }, + "duration": { + "title": "Duration", + "description": "Duration of the activity in seconds", + "type": "integer", + "minimum": 0 } }, "required": [ + "name", "timestamp", "activityType" ] From d8582728cf696317697081564cefbd4d778b8072 Mon Sep 17 00:00:00 2001 From: chime3 Date: Sun, 24 Nov 2024 18:07:46 -0700 Subject: [PATCH 5/5] fix: modified index fields --- activity/history/v0.1.0/schema.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/activity/history/v0.1.0/schema.json b/activity/history/v0.1.0/schema.json index 0678c12..9260077 100644 --- a/activity/history/v0.1.0/schema.json +++ b/activity/history/v0.1.0/schema.json @@ -15,7 +15,8 @@ "name": "activity_history", "indexes": { "name": ["name", "activityType", "timestamp"], - "insertedAt": ["insertedAt", "timestamp"], + "insertedAt": ["insertedAt"], + "timestamp": ["timestamp"], "source": ["sourceApplication", "sourceId"] } }, @@ -29,6 +30,7 @@ "name", "timestamp", "activityType", + "duration", "summary", "url", "sourceApplication",