Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL Sosial
bisago
bisago-fe
Commits
1bc264ee
Commit
1bc264ee
authored
May 31, 2021
by
Yoga Pratama
Browse files
[CHORES] Change date_time field to created
parent
3f4ddbbd
Pipeline
#80370
failed with stages
in 2 minutes and 2 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/config/custom_serializer.dart
View file @
1bc264ee
...
...
@@ -2,6 +2,6 @@ import 'package:intl/intl.dart';
class
CustomSerializer
{
static
DateTime
stringToDateTime
(
String
date
)
{
return
DateFormat
(
'dd-MM-yyyy hh:mm
:ss
'
)
.
parse
(
date
);
return
DateFormat
(
'dd-MM-yyyy hh:mm'
)
.
parse
(
date
);
}
}
lib/model/komentar_posting.dart
View file @
1bc264ee
...
...
@@ -14,10 +14,15 @@ class KomentarPostingModel {
final
int
id
;
final
String
deskripsi
;
final
String
creator
;
@JsonKey
(
name:
'date_time'
,
fromJson:
CustomSerializer
.
stringToDateTime
)
final
DateTime
dateTime
;
@JsonKey
(
fromJson:
CustomSerializer
.
stringToDateTime
)
final
DateTime
created
;
KomentarPostingModel
({
this
.
id
,
this
.
deskripsi
,
this
.
creator
,
this
.
dateTime
});
KomentarPostingModel
({
this
.
id
,
this
.
deskripsi
,
this
.
creator
,
this
.
created
,
});
factory
KomentarPostingModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=
>
_$KomentarPostingModelFromJson
(
json
);
...
...
lib/model/komentar_posting.g.dart
View file @
1bc264ee
...
...
@@ -27,7 +27,7 @@ KomentarPostingModel _$KomentarPostingModelFromJson(Map<String, dynamic> json) {
id:
json
[
'id'
]
as
int
,
deskripsi:
json
[
'deskripsi'
]
as
String
,
creator:
json
[
'creator'
]
as
String
,
dateTime
:
CustomSerializer
.
stringToDateTime
(
json
[
'
date_time
'
]
as
String
),
created
:
CustomSerializer
.
stringToDateTime
(
json
[
'
created
'
]
as
String
),
);
}
...
...
@@ -37,5 +37,5 @@ Map<String, dynamic> _$KomentarPostingModelToJson(
'id'
:
instance
.
id
,
'deskripsi'
:
instance
.
deskripsi
,
'creator'
:
instance
.
creator
,
'
date_time
'
:
instance
.
dateTime
?.
toIso8601String
(),
'
created
'
:
instance
.
created
?.
toIso8601String
(),
};
lib/model/komentar_posting_kegiatan.dart
View file @
1bc264ee
import
'package:intl/intl.dart'
;
import
'package:json_annotation/json_annotation.dart'
;
import
'package:bisaGo/config/custom_serializer.dart'
;
...
...
@@ -14,18 +15,18 @@ class KomentarPostingKegiatanModel {
final
int
id
;
final
String
creator
;
final
String
deskripsi
;
@JsonKey
(
name:
'created'
,
fromJson:
CustomSerializer
.
stringToDateTime
)
@JsonKey
(
name:
'created'
,
fromJson:
_
stringToDateTime
)
final
DateTime
created
;
KomentarPostingKegiatanModel
(
{
this
.
id
,
this
.
creator
,
this
.
deskripsi
,
this
.
created
}
);
{
this
.
id
,
this
.
creator
,
this
.
deskripsi
,
this
.
created
});
factory
KomentarPostingKegiatanModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=
>
_$KomentarPostingKegiatanModelFromJson
(
json
);
Map
<
String
,
dynamic
>
toJson
()
=
>
_$KomentarPostingKegiatanModelToJson
(
this
);
}
DateTime
_stringToDateTime
(
String
date
)
{
return
DateFormat
(
'yyy-MM-dd hh:mm'
)
.
parse
(
date
);
}
lib/model/komentar_posting_kegiatan.g.dart
View file @
1bc264ee
...
...
@@ -29,7 +29,7 @@ KomentarPostingKegiatanModel _$KomentarPostingKegiatanModelFromJson(
id:
json
[
'id'
]
as
int
,
creator:
json
[
'creator'
]
as
String
,
deskripsi:
json
[
'deskripsi'
]
as
String
,
created:
CustomSerializer
.
stringToDateTime
(
json
[
'created'
]
as
String
),
created:
_
stringToDateTime
(
json
[
'created'
]
as
String
),
);
}
...
...
lib/page/dashboard/dashboard.dart
View file @
1bc264ee
...
...
@@ -82,7 +82,7 @@ class DashboardState extends State<Dashboard> {
final
String
title
=
data
[
'title'
];
Flushbar
(
title:
title
,
message:
'"
$
msg
"'
,
message:
msg
,
duration:
Duration
(
seconds:
8
),
backgroundColor:
Color
(
0xFF003566
),
onTap:
(
_
)
{
...
...
lib/page/filter_fasilitas/postingan/detail_post.dart
View file @
1bc264ee
...
...
@@ -296,7 +296,7 @@ class _DetailPostPageState extends State<DetailPostPage> {
return
Column
(
children:
allKomentarPostingFromApi
.
map
<
Widget
>((
k
)
=
>
komentarPlaceHolder
(
k
.
creator
,
k
.
dateTime
,
k
.
deskripsi
))
k
.
creator
,
k
.
created
,
k
.
deskripsi
))
.
toList
());
}
break
;
...
...
lib/repository/kegiatan_repository.dart
View file @
1bc264ee
...
...
@@ -55,10 +55,12 @@ class KegiatanRepository implements BaseKegiatanRepository {
);
return
response
;
}
@override
Future
<
KegiatanModel
>
fetchDetailKegiatan
(
String
placeId
,
int
kegiatanId
)
async
{
final
url
=
'/informasi-fasilitas/lokasi/detail-kegiatan/
$placeId
/
$kegiatanId
/'
;
Future
<
KegiatanModel
>
fetchDetailKegiatan
(
String
placeId
,
int
kegiatanId
)
async
{
final
url
=
'/informasi-fasilitas/lokasi/detail-kegiatan/
$placeId
/
$kegiatanId
/'
;
final
response
=
await
_network
.
get
(
url:
url
,
isLogin:
false
);
var
kegiatan
=
KegiatanModel
.
fromJson
(
response
);
kegiatan
.
image
=
await
fetchImages
(
kegiatan
.
placeId
,
kegiatan
.
id
);
...
...
test/model_test.dart
View file @
1bc264ee
...
...
@@ -9,13 +9,13 @@ void main() {
'id'
:
1
,
'deskripsi'
:
'This is a test'
,
'creator'
:
'Test'
,
'
date_time'
:
'2020-11-18
00:13:52
.939668
'
'
created'
:
'18-11-2020
00:13:52'
};
final
returnKomentarPostingData
=
{
'id'
:
1
,
'deskripsi'
:
'This is a test'
,
'creator'
:
'Test'
,
'
date_time
'
:
'2020-11-18T00:13:00.000'
'
created
'
:
'2020-11-18T00:13:00.000'
};
final
userData
=
{
'is_login'
:
true
,
...
...
@@ -36,7 +36,7 @@ void main() {
'deskripsi'
:
'Ada toilet khusus disabilitas terletak di lantai 2 dekat kintan'
,
'creator'
:
''
,
'date_time'
:
'
2020-11-18
00:13:52
.939668
'
,
'date_time'
:
'
18-11-2020
00:13:52'
,
'rating'
:
3
,
'tag'
:
'KR'
,
'disabilitas'
:
[
'DF'
],
...
...
@@ -77,7 +77,7 @@ void main() {
id:
2
,
deskripsi:
'This is a test'
,
creator:
'Test'
,
dateTime
:
DateTime
.
now
());
created
:
DateTime
.
now
());
expect
(
komentarPostingModel
,
isInstanceOf
<
KomentarPostingModel
>());
expect
(
komentarPostingWithConstructor
,
isInstanceOf
<
KomentarPostingModel
>());
...
...
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