Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sergey Kozlovskiy
Schema
Commits
aa94bd4f
Commit
aa94bd4f
authored
4 years ago
by
Ruben Seggers
Browse files
Options
Download
Email Patches
Plain Diff
Update schema export iOS app for rollback realm version
parent
d1d603b2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
.gitignore
+1
-0
.gitignore
EdgeAndPropertyHierarchy/session/session.json
+0
-4
EdgeAndPropertyHierarchy/session/session.json
EdgeAndPropertyHierarchy/sessions/sessions.json
+0
-4
EdgeAndPropertyHierarchy/sessions/sessions.json
EdgeAndPropertyHierarchy/syncState/syncState.json
+0
-4
EdgeAndPropertyHierarchy/syncState/syncState.json
EdgeAndPropertyHierarchy/views/views.json
+0
-4
EdgeAndPropertyHierarchy/views/views.json
TypeHierarchy/Item/CVUStateDefinition/CVUStoredDefinition.json
+7
-0
...ierarchy/Item/CVUStateDefinition/CVUStoredDefinition.json
TypeHierarchy/Item/Edge/Edge.json
+1
-6
TypeHierarchy/Item/Edge/Edge.json
TypeHierarchy/Item/Item.json
+0
-4
TypeHierarchy/Item/Item.json
TypeHierarchy/Item/Session/Session.json
+0
-22
TypeHierarchy/Item/Session/Session.json
TypeHierarchy/Item/SessionView/SessionView.json
+0
-30
TypeHierarchy/Item/SessionView/SessionView.json
TypeHierarchy/Item/Sessions/Sessions.json
+0
-14
TypeHierarchy/Item/Sessions/Sessions.json
tools/export_schema_ios_application.js
+19
-26
tools/export_schema_ios_application.js
with
28 additions
and
118 deletions
+28
-118
.gitignore
+
1
-
0
View file @
aa94bd4f
# Output files
*schema.swift
*schema_target.swift
*schema_target2.swift
*schema.ts
*schema_target.ts
*autogenerated_database_schema.json
...
...
This diff is collapsed.
Click to expand it.
EdgeAndPropertyHierarchy/session/session.json
deleted
100644 → 0
+
0
-
4
View file @
d1d603b2
{
"description"
:
"TBD"
,
"type"
:
"Session"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
EdgeAndPropertyHierarchy/sessions/sessions.json
deleted
100644 → 0
+
0
-
4
View file @
d1d603b2
{
"description"
:
"TBD"
,
"type"
:
"Session"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
EdgeAndPropertyHierarchy/syncState/syncState.json
deleted
100644 → 0
+
0
-
4
View file @
d1d603b2
{
"description"
:
"Item describing syncing information about this Item, like loading state, versioning, etc."
,
"type"
:
"SyncState"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
EdgeAndPropertyHierarchy/views/views.json
deleted
100644 → 0
+
0
-
4
View file @
d1d603b2
{
"description"
:
"TBD"
,
"type"
:
"SessionView"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
TypeHierarchy/Item/
Sync
State
/SyncState
.json
→
TypeHierarchy/Item/
CVU
State
Definition/CVUStoredDefinition
.json
+
7
-
0
View file @
aa94bd4f
{
"description"
:
"TBD"
,
"properties"
:
[
"isPartiallyLoaded"
,
"actionNeeded"
,
"updatedFields"
,
"changedInThisSession"
],
"properties"
:
[],
"relations"
:
{},
"foregroundColor"
:
"#ffffff"
,
"backgroundColor"
:
"#93c47d"
...
...
This diff is collapsed.
Click to expand it.
TypeHierarchy/Item/Edge/Edge.json
+
1
-
6
View file @
aa94bd4f
...
...
@@ -11,12 +11,7 @@
"version"
,
"edgeLabel"
],
"relations"
:
{
"syncState"
:
{
"sequenced"
:
false
,
"singular"
:
true
}
},
"relations"
:
{},
"foregroundColor"
:
"#ffffff"
,
"backgroundColor"
:
"#93c47d"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
TypeHierarchy/Item/Item.json
+
0
-
4
View file @
aa94bd4f
...
...
@@ -24,10 +24,6 @@
"label"
:
{
"sequenced"
:
false
,
"singular"
:
false
},
"syncState"
:
{
"sequenced"
:
false
,
"singular"
:
true
}
},
"foregroundColor"
:
"#ffffff"
,
...
...
This diff is collapsed.
Click to expand it.
TypeHierarchy/Item/Session/Session.json
deleted
100644 → 0
+
0
-
22
View file @
d1d603b2
{
"description"
:
"TBD"
,
"properties"
:
[
"currentViewIndex"
,
"editMode"
,
"name"
,
"showContextPane"
,
"showFilterPanel"
],
"relations"
:
{
"screenshot"
:
{
"sequenced"
:
false
,
"singular"
:
true
},
"views"
:
{
"sequenced"
:
true
,
"singular"
:
false
}
},
"foregroundColor"
:
"#ffffff"
,
"backgroundColor"
:
"#93c47d"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
TypeHierarchy/Item/SessionView/SessionView.json
deleted
100644 → 0
+
0
-
30
View file @
d1d603b2
{
"description"
:
"TBD"
,
"properties"
:
[
"name"
],
"relations"
:
{
"datasource"
:
{
"sequenced"
:
false
,
"singular"
:
true
},
"session"
:
{
"sequenced"
:
false
,
"singular"
:
true
},
"userState"
:
{
"sequenced"
:
false
,
"singular"
:
true
},
"viewDefinition"
:
{
"sequenced"
:
false
,
"singular"
:
true
},
"viewArguments"
:
{
"sequenced"
:
false
,
"singular"
:
true
}
},
"foregroundColor"
:
"#ffffff"
,
"backgroundColor"
:
"#93c47d"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
TypeHierarchy/Item/Sessions/Sessions.json
deleted
100644 → 0
+
0
-
14
View file @
d1d603b2
{
"description"
:
"TBD"
,
"properties"
:
[
"currentSessionIndex"
],
"relations"
:
{
"sessions"
:
{
"sequenced"
:
true
,
"singular"
:
false
}
},
"foregroundColor"
:
"#ffffff"
,
"backgroundColor"
:
"#93c47d"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tools/export_schema_ios_application.js
+
19
-
26
View file @
aa94bd4f
...
...
@@ -21,7 +21,7 @@ function getItemFamily() {
function
getDataItemClasses
()
{
let
dataItemClasses
=
[];
for
(
const
entity
of
Object
.
keys
(
entityHierarchy
))
{
if
([
'
Datasource
'
,
'
UserState
'
,
'
ViewArguments
'
].
includes
(
entity
))
continue
;
if
([
'
Datasource
'
,
'
UserState
'
,
'
ViewArguments
'
,
'
CVUStateDefinition
'
].
includes
(
entity
))
continue
;
let
classDescription
=
`\n///
${
entityHierarchy
[
entity
][
'
description
'
]}
\n`
;
classDescription
=
helpers
.
wrapText
(
`///
${
entityHierarchy
[
entity
][
'
description
'
]}
`
,
100
,
'
\n
///
'
);
...
...
@@ -29,20 +29,11 @@ function getDataItemClasses() {
let
classDefinition
;
switch
(
entity
)
{
case
'
Item
'
:
classDefinition
=
`public class SchemaItem: Object, Codable, Identifiable {`
;
break
;
case
'
Session
'
:
classDefinition
=
`public class SchemaSession : Item {`
;
break
;
case
'
Sessions
'
:
classDefinition
=
`public class SchemaSessions : Item {`
;
classDefinition
=
`public class SchemaItem: SyncableItem, Codable, Identifiable {`
;
break
;
case
'
Person
'
:
classDefinition
=
`public class SchemaPerson : Item {`
;
break
;
case
'
SyncState
'
:
classDefinition
=
'
public class SyncState: Object, Codable {
\n
let updatedFields = List<String>()
'
;
break
;
case
'
Edge
'
:
classDefinition
=
`public class Edge : Object, Codable {`
;
break
;
...
...
@@ -72,7 +63,7 @@ function getDataItemClasses() {
relations
+=
helpers
.
wrapText
(
` ///
${
predicateHierarchy
[
field
][
'
description
'
]}
\n`
,
96
);
}
if
([
'
allEdges
'
,
'
currentViewIndex
'
,
'
currentSessionIndex
'
,
'
version
'
,
'
views
'
,
'
sessions
'
,
'
syncState
'
].
includes
(
field
))
{
if
([
'
allEdges
'
,
'
currentViewIndex
'
,
'
currentSessionIndex
'
,
'
version
'
].
includes
(
field
))
{
switch
(
field
)
{
case
'
allEdges
'
:
properties
+=
'
let allEdges = List<Edge>()
\n
'
;
...
...
@@ -87,20 +78,6 @@ function getDataItemClasses() {
properties
+=
` @objc dynamic var
${
field
}
:Int = 1\n`
;
propertiesDecoder
+=
`
${
field
}
= try decoder.decodeIfPresent("
${
field
}
") ??
${
field
}
\n`
;
break
;
case
'
views
'
:
relations
+=
` var
${
field
}
: Results<
${
type
}
>? {\n`
+
` edges("view")?.sorted(byKeyPath: "sequence").items(type:
${
type
}
.self)\n`
+
'
}
\n\n
'
;
break
;
case
'
sessions
'
:
relations
+=
` var
${
field
}
: Results<
${
type
}
>? {\n`
+
` edges("session")?.sorted(byKeyPath: "sequence").items(type:
${
type
}
.self)\n`
+
'
}
\n\n
'
;
break
;
case
'
syncState
'
:
properties
+=
` @objc dynamic var
${
field
}
:
${
type
}
? =
${
type
}
()\n`
;
propertiesDecoder
+=
`
${
field
}
= try decoder.decodeIfPresent("
${
field
}
") ??
${
field
}
\n`
;
break
;
}
}
else
{
switch
(
type
)
{
...
...
@@ -257,6 +234,22 @@ enum ItemFamily: String, ClassFamily, CaseIterable {
}
}
public class SyncableItem: Object {
let _updated = List<String>()
/// TBD
@objc dynamic var _partial:Bool = false
/// TBD
@objc dynamic var _action:String? = nil
/// TBD
@objc dynamic var _changedInSession:Bool = false
}
public class CVUStateDefinition : CVUStoredDefinition {
required init () {
super.init()
}
}
${
helpers
.
insertList
(
dataItemClasses
)}
func dataItemListToArray(_ object: Any) -> [Item] {
var collection: [Item] = []
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets