Skip to content

Commit

Permalink
✨ (ContentKit): Activity - Add createdAt, lastEditedAt properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Feb 28, 2024
1 parent 07b974d commit 09b2517
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ struct ActivityDetailsView: View {
Section("Information") {
RowView(label: "UUID", value: self.activity.id)
RowView(label: "Name", value: self.activity.name)
RowView(label: "Created at", value: self.activity.createdAt.description)
RowView(label: "Last edited at", value: self.activity.lastEditedAt.description)

RowView(label: "Status", value: self.activity.status == .published ? "published" : "draft")

Expand Down
3 changes: 3 additions & 0 deletions Modules/ContentKit/Sources/Activity/Activity+Mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public extension Activity {
uuid: E7EE9CA4B13B49AF96CD77A9DF90833B
name: mock_activity
created_at: 2024-02-28T12:53:48+00:00
last_edited_at: 2024-02-28T12:53:48+00:00
status: published
authors:
Expand Down
8 changes: 7 additions & 1 deletion Modules/ContentKit/Sources/Activity/Activity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public struct Activity: Decodable, Identifiable {

self.uuid = try container.decode(String.self, forKey: .uuid)
self.name = try container.decode(String.self, forKey: .name)
self.createdAt = try container.decode(Date.self, forKey: .createdAt)
self.lastEditedAt = try container.decode(Date.self, forKey: .lastEditedAt)
self.status = try container.decode(Status.self, forKey: .status)

self.authors = try container.decode([String].self, forKey: .authors)
Expand All @@ -38,6 +40,8 @@ public struct Activity: Decodable, Identifiable {

public let uuid: String
public let name: String
public let createdAt: Date
public let lastEditedAt: Date
public let status: Status

public let authors: [String] // TODO: (@ladislas) - implement authors

Check warning on line 47 in Modules/ContentKit/Sources/Activity/Activity.swift

View workflow job for this annotation

GitHub Actions / swiftlint

TODOs should be resolved ((@ladislas) - implement author...) (todo)
Expand Down Expand Up @@ -72,12 +76,14 @@ public struct Activity: Decodable, Identifiable {
private enum CodingKeys: String, CodingKey {
case uuid
case name
case createdAt = "created_at"
case lastEditedAt = "last_edited_at"
case status
case authors
case skills
case hmi
case types
case tags
case status
case locales
case l10n
case exercicesPayload = "exercises_payload"
Expand Down

0 comments on commit 09b2517

Please sign in to comment.