Skip to content

GO-3938 Add includeTime relation - details level #2357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/relationutils/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func RelationFromDetails(det *domain.Details) *Relation {
Description: det.GetString(bundle.RelationKeyDescription),
Creator: det.GetString(bundle.RelationKeyCreator),
Revision: det.GetInt64(bundle.RelationKeyRevision),
IncludeTime: det.GetBool(bundle.RelationKeyIncludeTime),
},
}

Expand Down Expand Up @@ -59,8 +60,9 @@ func (r *Relation) ToDetails() *domain.Details {
bundle.RelationKeyRelationReadonlyValue: domain.Bool(r.GetReadOnly()),
bundle.RelationKeyType: domain.String(bundle.TypeKeyRelation.BundledURL()),
// TODO Is it ok?
bundle.RelationKeyUniqueKey: domain.String(domain.RelationKey(r.GetKey()).URL()),
bundle.RelationKeyRevision: domain.Int64(r.GetRevision()),
bundle.RelationKeyUniqueKey: domain.String(domain.RelationKey(r.GetKey()).URL()),
bundle.RelationKeyRevision: domain.Int64(r.GetRevision()),
bundle.RelationKeyIncludeTime: domain.Bool(r.GetIncludeTime()),
})
}

Expand Down
9 changes: 6 additions & 3 deletions docs/proto.md
Original file line number Diff line number Diff line change
Expand Up @@ -30601,9 +30601,11 @@ Bookmark is to keep a web-link and to preview a content.
| key | [string](#string) | | |
| isVisible | [bool](#bool) | | |
| width | [int32](#int32) | | the displayed column % calculated based on other visible relations |
| dateIncludeTime | [bool](#bool) | | |
| timeFormat | [Block.Content.Dataview.Relation.TimeFormat](#anytype-model-Block-Content-Dataview-Relation-TimeFormat) | | |
| dateFormat | [Block.Content.Dataview.Relation.DateFormat](#anytype-model-Block-Content-Dataview-Relation-DateFormat) | | |
| dateIncludeTime | [bool](#bool) | | bool isReadOnly = 4; // deprecated

deprecated |
| timeFormat | [Block.Content.Dataview.Relation.TimeFormat](#anytype-model-Block-Content-Dataview-Relation-TimeFormat) | | deprecated |
| dateFormat | [Block.Content.Dataview.Relation.DateFormat](#anytype-model-Block-Content-Dataview-Relation-DateFormat) | | deprecated |
| formula | [Block.Content.Dataview.Relation.FormulaType](#anytype-model-Block-Content-Dataview-Relation-FormulaType) | | |
| align | [Block.Align](#anytype-model-Block-Align) | | |

Expand Down Expand Up @@ -31871,6 +31873,7 @@ default dictionary with unique values to choose for select/multiSelect format |
deprecated, to be removed |
| creator | [string](#string) | | creator profile id |
| revision | [int64](#int64) | | revision of system relation. Used to check if we should change relation content or not |
| includeTime | [bool](#bool) | | indicates whether value of relation with date format should be processed with seconds precision |



Expand Down
4 changes: 4 additions & 0 deletions pkg/lib/bundle/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Relation struct {
Source string `json:"source"`
Description string `json:"description"`
Revision int `json:"revision"`
IncludeTime bool `json:"includeTime"`
}

type ObjectType struct {
Expand Down Expand Up @@ -222,6 +223,9 @@ func generateRelations() error {
if relation.Revision != 0 {
dictS[Id("Revision")] = Lit(relation.Revision)
}
if relation.IncludeTime {
dictS[Id("IncludeTime")] = Lit(relation.IncludeTime)
}

dict[Id(relConst(relation.Key))] = Block(dictS)
}
Expand Down
35 changes: 33 additions & 2 deletions pkg/lib/bundle/relation.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/anyproto/anytype-heart/pkg/lib/pb/model"
)

const RelationChecksum = "62a158a458a241cdf5b502bad800a109a8917ab9026826dd1274262c46b1f839"
const RelationChecksum = "d48a3d0b09921529f922f42d214a6b5c00b5ce939bb5056b4aa80b9a1e4cd0e0"
const (
RelationKeyTag domain.RelationKey = "tag"
RelationKeyCamera domain.RelationKey = "camera"
Expand Down Expand Up @@ -160,6 +160,7 @@ const (
RelationKeyAutoWidgetTargets domain.RelationKey = "autoWidgetTargets"
RelationKeyAutoWidgetDisabled domain.RelationKey = "autoWidgetDisabled"
RelationKeyPluralName domain.RelationKey = "pluralName"
RelationKeyIncludeTime domain.RelationKey = "includeTime"
)

var (
Expand All @@ -170,11 +171,13 @@ var (
Description: "Date when the file were added into the anytype",
Format: model.RelationFormat_date,
Id: "_braddedDate",
IncludeTime: true,
Key: "addedDate",
MaxCount: 1,
Name: "Added date",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeyAperture: {
Expand Down Expand Up @@ -465,11 +468,13 @@ var (
Description: "Date when the object was initially created",
Format: model.RelationFormat_date,
Id: "_brcreatedDate",
IncludeTime: true,
Key: "createdDate",
MaxCount: 1,
Name: "Creation date",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeyCreator: {
Expand Down Expand Up @@ -562,11 +567,13 @@ var (
Description: "",
Format: model.RelationFormat_date,
Id: "_brdueDate",
IncludeTime: true,
Key: "dueDate",
MaxCount: 1,
Name: "Due date",
ReadOnly: false,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeyEmail: {
Expand Down Expand Up @@ -898,6 +905,19 @@ var (
ReadOnlyRelation: true,
Scope: model.Relation_type,
},
RelationKeyIncludeTime: {

DataSource: model.Relation_details,
Description: "Should time be shown for relation values with date format",
Format: model.RelationFormat_checkbox,
Hidden: true,
Id: "_brincludeTime",
Key: "includeTime",
Name: "IncludeTime",
ReadOnly: true,
ReadOnlyRelation: true,
Scope: model.Relation_type,
},
RelationKeyIngredients: {

DataSource: model.Relation_details,
Expand Down Expand Up @@ -1085,11 +1105,13 @@ var (
Description: "Date when the object was modified last time",
Format: model.RelationFormat_date,
Id: "_brlastModifiedDate",
IncludeTime: true,
Key: "lastModifiedDate",
MaxCount: 1,
Name: "Last modified date",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeyLastOpenedDate: {
Expand All @@ -1098,11 +1120,13 @@ var (
Description: "Date when the object was modified last opened",
Format: model.RelationFormat_date,
Id: "_brlastOpenedDate",
IncludeTime: true,
Key: "lastOpenedDate",
MaxCount: 1,
Name: "Last opened date",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeyLastUsedDate: {
Expand All @@ -1112,12 +1136,13 @@ var (
Format: model.RelationFormat_date,
Hidden: true,
Id: "_brlastUsedDate",
IncludeTime: true,
Key: "lastUsedDate",
MaxCount: 1,
Name: "Last used date",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Revision: 2,
Scope: model.Relation_type,
},
RelationKeyLatestAclHeadId: {
Expand Down Expand Up @@ -1983,11 +2008,13 @@ var (
Format: model.RelationFormat_date,
Hidden: true,
Id: "_brsyncDate",
IncludeTime: true,
Key: "syncDate",
MaxCount: 1,
Name: "Sync date",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeySyncError: {
Expand Down Expand Up @@ -2106,11 +2133,13 @@ var (
Format: model.RelationFormat_date,
Hidden: true,
Id: "_brtimestamp",
IncludeTime: true,
Key: "timestamp",
MaxCount: 1,
Name: "Timestamp",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeyToBeDeletedDate: {
Expand All @@ -2120,11 +2149,13 @@ var (
Format: model.RelationFormat_date,
Hidden: true,
Id: "_brtoBeDeletedDate",
IncludeTime: true,
Key: "toBeDeletedDate",
MaxCount: 1,
Name: "Date to delete",
ReadOnly: true,
ReadOnlyRelation: true,
Revision: 1,
Scope: model.Relation_type,
},
RelationKeyType: {
Expand Down
45 changes: 36 additions & 9 deletions pkg/lib/bundle/relations.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"maxCount": 1,
"name": "Creation date",
"readonly": true,
"source": "derived"
"source": "derived",
"includeTime": true,
"revision": 1
},
{
"description": "Date when the object will be deleted from your device",
Expand All @@ -46,7 +48,9 @@
"maxCount": 1,
"name": "Date to delete",
"readonly": true,
"source": "account"
"source": "account",
"includeTime": true,
"revision": 1
},
{
"description": "Prioritized target types for the relation's value",
Expand Down Expand Up @@ -380,7 +384,9 @@
"maxCount": 1,
"name": "Last modified date",
"readonly": true,
"source": "derived"
"source": "derived",
"includeTime": true,
"revision": 1
},
{
"description": "List of recommended relations",
Expand Down Expand Up @@ -427,7 +433,9 @@
"maxCount": 1,
"name": "Last opened date",
"readonly": true,
"source": "account"
"source": "account",
"includeTime": true,
"revision": 1
},
{
"format": "object",
Expand Down Expand Up @@ -460,7 +468,9 @@
"maxCount": 1,
"name": "Due date",
"readonly": false,
"source": "details"
"source": "details",
"includeTime": true,
"revision": 1
},
{
"description": "1 emoji(can contains multiple UTF symbols) used as an icon",
Expand Down Expand Up @@ -542,7 +552,9 @@
"maxCount": 1,
"name": "Added date",
"readonly": true,
"source": "details"
"source": "details",
"includeTime": true,
"revision": 1
},
{
"description": "Person who is responsible for this task or object",
Expand Down Expand Up @@ -1295,7 +1307,8 @@
"name": "Last used date",
"readonly": true,
"source": "local",
"revision": 1
"revision": 2,
"includeTime": true
},
{
"description": "Revision of system object",
Expand Down Expand Up @@ -1356,7 +1369,9 @@
"maxCount": 1,
"name": "Sync date",
"readonly": true,
"source": "local"
"source": "local",
"includeTime": true,
"revision": 1
},
{
"description": "Object sync error",
Expand Down Expand Up @@ -1406,7 +1421,9 @@
"maxCount": 1,
"name": "Timestamp",
"readonly": true,
"source": "derived"
"source": "derived",
"includeTime": true,
"revision": 1
},
{
"description": "Width of object's layout",
Expand Down Expand Up @@ -1535,5 +1552,15 @@
"name": "Plural name",
"readonly": false,
"source": "details"
},
{
"description": "Should time be shown for relation values with date format",
"format": "checkbox",
"hidden": true,
"key": "includeTime",
"maxCount": 0,
"name": "IncludeTime",
"readonly": true,
"source": "details"
}
]
Loading
Loading