Skip to content

Commit

Permalink
remove attachments from tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomás Ciccola committed Aug 28, 2024
1 parent d820328 commit 20140bf
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 70 deletions.
14 changes: 0 additions & 14 deletions proto/track/v1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,13 @@ message Track_1 {
Common_1 common = 1;
repeated Position locations = 2;
repeated ObservationRef observationRefs = 3;
repeated Attachment attachments = 4;
map<string, TagValue_1> tags = 5;

enum AttachmentType {
attachment_type_unspecified = 0;
photo = 1;
video = 2;
audio = 3;
}

message ObservationRef {
bytes docId = 1;
VersionId_1 versionId = 2;
}

message Attachment {
bytes driveDiscoveryId = 1;
string name = 2;
AttachmentType type = 3;
bytes hash = 4;
}

message Position {
google.protobuf.Timestamp timestamp = 1;
Expand Down
46 changes: 2 additions & 44 deletions schema/track/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://mapeo.world/schemas/track/v1.json",
"title": "Track",
"description": "A track is a recording of positions over time, with associated tags and attachments, similar to an observation",
"description": "A track is a recording of positions over time, with associated tags, similar to an observation",
"definitions": {
"position": {
"description": "Position details",
Expand Down Expand Up @@ -79,42 +79,6 @@
"required": ["docId", "versionId"]
}
},
"attachments": {
"type": "array",
"description": "media or other data that are attached to this track",
"items": {
"type": "object",
"properties": {
"driveDiscoveryId": {
"type": "string",
"description": "core discovery id for the drive that the attachment belongs to"
},
"name": {
"type": "string",
"description": "name of the attachment"
},
"type": {
"type": "string",
"description": "string that describes the type of the attachment",
"meta:enum": {
"UNRECOGNIZED": "future attachment type"
},
"enum": [
"attachment_type_unspecified",
"photo",
"video",
"audio",
"UNRECOGNIZED"
]
},
"hash": {
"type": "string",
"description": "SHA256 hash of the attachment"
}
},
"required": ["driveDiscoveryId", "name", "type", "hash"]
}
},
"tags": {
"type": "object",
"description": "User-defined key-value pairs relevant to this track",
Expand Down Expand Up @@ -156,12 +120,6 @@
}
}
},
"required": [
"schemaName",
"locations",
"tags",
"observationRefs",
"attachments"
],
"required": ["schemaName", "locations", "tags", "observationRefs"],
"additionalProperties": false
}
1 change: 0 additions & 1 deletion src/lib/decode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ export const convertTrack: ConvertFunction<'track'> = (message, versionObj) => {
...rest,
observationRefs,
locations,
attachments: message.attachments.map(convertAttachment),
tags: convertTags(message.tags),
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/lib/encode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,11 @@ export const convertTrack: ConvertFunction<'track'> = (mapeoDoc) => {
}
}
)
const attachments = mapeoDoc.attachments.map(convertAttachment)

const track: CurrentProtoTypes['track'] = {
common: convertCommon(mapeoDoc),
...mapeoDoc,
observationRefs,
attachments,
tags: convertTags(mapeoDoc.tags),
locations: mapeoDoc.locations,
}
Expand Down
8 changes: 0 additions & 8 deletions test/fixtures/good-docs-completed.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,6 @@ export const goodDocsCompleted = [
versionId: cachedValues.refs.versionId,
},
],
attachments: [
{
name: 'myFile',
type: 'photo',
driveDiscoveryId: cachedValues.attachments.driveDiscoveryId,
hash: cachedValues.attachments.hash,
},
],
tags: {
someKeyForArrVal: ['arr', 'of', 'strings'],
},
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/good-docs-minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export const goodDocsMinimal = [
deleted: false,
locations: [],
observationRefs: [],
attachments: [],
tags: {},
},
expected: {},
Expand Down

0 comments on commit 20140bf

Please sign in to comment.