Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
appwrite-functions
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Car App
appwrite-functions
Commits
675a0dfb
Commit
675a0dfb
authored
1 year ago
by
Andri Joos
Browse files
Options
Downloads
Patches
Plain Diff
add start & end time to Route
parent
17af656c
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
functions/api/lib/route/route.dart
+13
-1
13 additions, 1 deletion
functions/api/lib/route/route.dart
functions/api/lib/route/route_database.dart
+2
-0
2 additions, 0 deletions
functions/api/lib/route/route_database.dart
with
15 additions
and
1 deletion
functions/api/lib/route/route.dart
+
13
−
1
View file @
675a0dfb
...
...
@@ -5,15 +5,21 @@ class Route implements DbModel, ResponseModel {
static
const
String
userIdDbFieldName
=
"userId"
;
static
const
String
teamIdDbFieldName
=
"teamId"
;
static
const
String
pointsDbFieldName
=
"points"
;
static
const
String
startTimeDbFieldName
=
"startTime"
;
static
const
String
endTimeDbFieldName
=
"endTime"
;
static
const
String
userIdRequestResponseFieldName
=
"userId"
;
static
const
String
teamIdRequestResponseFieldName
=
"teamId"
;
static
const
String
pointsRequestResponseFieldName
=
"points"
;
static
const
String
startTimeRequestResponseFieldName
=
"startTime"
;
static
const
String
endTimeRequestResponseFieldName
=
"endTime"
;
final
String
?
_id
;
final
List
<
Point
>
_points
;
final
String
_userId
;
final
String
?
_teamId
;
final
DateTime
startTime
;
final
DateTime
endTime
;
@override
String
?
get
id
=
>
_id
;
...
...
@@ -26,7 +32,7 @@ class Route implements DbModel, ResponseModel {
String
?
get
teamId
=
>
_teamId
;
Route
({
String
?
id
,
required
List
<
Point
>
points
,
required
String
userId
,
String
?
teamId
})
:
Route
({
String
?
id
,
required
List
<
Point
>
points
,
required
String
userId
,
String
?
teamId
,
required
this
.
startTime
,
required
this
.
endTime
})
:
_id
=
id
,
_points
=
points
,
_userId
=
userId
,
...
...
@@ -39,6 +45,8 @@ class Route implements DbModel, ResponseModel {
pointsDbFieldName:
pointIds
,
userIdDbFieldName
:
userId
,
teamIdDbFieldName
:
teamId
,
startTimeDbFieldName:
startTime
.
toIso8601String
(),
endTimeDbFieldName:
endTime
.
toIso8601String
(),
};
}
...
...
@@ -58,6 +66,8 @@ class Route implements DbModel, ResponseModel {
points:
getRequiredMapItem
<
Iterable
>(
pointsRequestResponseFieldName
,
map
)
.
map
((
e
)
=
>
Point
.
fromRequest
(
e
))
.
toList
(
growable:
false
),
userId:
userId
,
teamId:
getOptionalMapItem
(
teamIdRequestResponseFieldName
,
map
),
startTime:
DateTime
.
parse
(
getRequiredMapItem
(
startTimeRequestResponseFieldName
,
map
)),
endTime:
DateTime
.
parse
(
getRequiredMapItem
(
endTimeRequestResponseFieldName
,
map
)),
);
}
...
...
@@ -67,6 +77,8 @@ class Route implements DbModel, ResponseModel {
points:
getRequiredMapItem
<
Iterable
>(
pointsDbFieldName
,
map
)
.
map
((
e
)
=
>
Point
.
fromDbData
(
e
))
.
toList
(
growable:
false
),
userId:
getRequiredMapItem
(
userIdDbFieldName
,
map
),
teamId:
getOptionalMapItem
(
teamIdDbFieldName
,
map
),
startTime:
DateTime
.
parse
(
getRequiredMapItem
(
startTimeDbFieldName
,
map
)),
endTime:
DateTime
.
parse
(
getRequiredMapItem
(
endTimeDbFieldName
,
map
)),
);
}
}
This diff is collapsed.
Click to expand it.
functions/api/lib/route/route_database.dart
+
2
−
0
View file @
675a0dfb
...
...
@@ -34,6 +34,8 @@ class RouteDatabase extends BaseDatabase<Route, Route> {
points:
points
,
userId:
request
.
item
.
userId
,
teamId:
request
.
item
.
teamId
,
startTime:
request
.
item
.
startTime
,
endTime:
request
.
item
.
endTime
,
),
requestingUser:
request
.
requestingUser
,
);
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment