refactor: Align with Go conventions and improve maintainability

Renames the `OriginalUrl` field to `OriginalURL` across media models to adhere to Go's common initialisms convention. The `json` tag is unchanged to maintain API compatibility.

Introduces constants for exporter formats (e.g., `FormatMarkdown`, `FormatDocx`) to eliminate the use of magic strings, enhancing type safety and making the code easier to maintain.

Additionally, this commit includes several minor code quality improvements:
- Wraps file-writing errors in exporters to provide more context.
- Removes redundant package-level comments from test files.
- Applies various minor linting fixes throughout the codebase.
This commit is contained in:
2025-11-06 16:45:25 +01:00
parent d8e4d97841
commit b56c9fa29f
26 changed files with 53 additions and 77 deletions

View File

@ -1,5 +1,3 @@
// Package models defines the data structures representing Articulate Rise courses.
// These structures closely match the JSON format used by Articulate Rise.
package models
// Media represents a media element that can be either an image or a video.
@ -23,8 +21,8 @@ type ImageMedia struct {
Height int `json:"height,omitempty"`
// CrushedKey is the identifier for a compressed version of the image
CrushedKey string `json:"crushedKey,omitempty"`
// OriginalUrl is the URL to the full-resolution image
OriginalUrl string `json:"originalUrl"`
// OriginalURL is the URL to the full-resolution image
OriginalURL string `json:"originalUrl"`
// UseCrushedKey indicates whether to use the compressed version
UseCrushedKey bool `json:"useCrushedKey,omitempty"`
}
@ -45,6 +43,6 @@ type VideoMedia struct {
InputKey string `json:"inputKey,omitempty"`
// Thumbnail is the URL to a smaller preview image
Thumbnail string `json:"thumbnail,omitempty"`
// OriginalUrl is the URL to the source video file
OriginalUrl string `json:"originalUrl"`
// OriginalURL is the URL to the source video file
OriginalURL string `json:"originalUrl"`
}