Domain models represent the core business entities in the application’s domain layer.
Article
Represents a summary view of a space flight news article. Used in list views and search results.
data class Article(
val id: Long,
val title: String,
val imageUrl: String,
val newsSite: String,
val publishedAt: String
)
Properties
Unique identifier for the article.
The title of the article.
URL of the article’s featured image.
Name of the news site that published the article (e.g., “Space.com”, “NASA”).
Publication date and time of the article in ISO 8601 format.
Example
val article = Article(
id = 12345L,
title = "NASA Launches New Mars Rover",
imageUrl = "https://example.com/images/mars-rover.jpg",
newsSite = "NASA",
publishedAt = "2024-03-15T10:30:00Z"
)
ArticleDetail
Represents the complete details of a space flight news article. Used in detail views with full article information.
data class ArticleDetail(
val id: Long,
val title: String,
val authors: List<Author>,
val url: String,
val newsSite: String,
val imageUrl: String,
val summary: String,
val publishedAt: String,
val updatedAt: String
)
Properties
Unique identifier for the article.
The title of the article.
List of authors who wrote the article. See Author for details.
URL to the full article on the original news site.
Name of the news site that published the article.
URL of the article’s featured image.
Brief summary or excerpt of the article content.
Publication date and time of the article in ISO 8601 format.
Last update date and time of the article in ISO 8601 format.
Example
val articleDetail = ArticleDetail(
id = 12345L,
title = "NASA Launches New Mars Rover",
authors = listOf(
Author(name = "John Doe"),
Author(name = "Jane Smith")
),
url = "https://www.nasa.gov/article/mars-rover-launch",
newsSite = "NASA",
imageUrl = "https://example.com/images/mars-rover.jpg",
summary = "NASA successfully launched its newest Mars rover today...",
publishedAt = "2024-03-15T10:30:00Z",
updatedAt = "2024-03-15T14:20:00Z"
)
Author
Represents an author of a space flight news article.
data class Author(
val name: String
)
Properties
The full name of the author.
Example
val author = Author(
name = "Dr. Emily Johnson"
)
Usage
The Author model is typically used as part of the ArticleDetail model to represent article attribution:
val authors = listOf(
Author(name = "Dr. Emily Johnson"),
Author(name = "Michael Chen")
)
val article = ArticleDetail(
// ... other properties
authors = authors
)