some code cleanup and dependency updates #21

Merged
mars3142 merged 1 commits from feature/code_cleanup into main 2025-12-09 20:24:18 +00:00
Owner
No description provided.
mars3142 added 1 commit 2025-12-08 21:31:46 +00:00
some code cleanup and dependency updates
All checks were successful
Build and Push Multi-Arch Docker Image / build-and-push (push) Successful in 15m32s
efd34616b1
Signed-off-by: Peter Siegmund <developer@mars3142.org>
First-time contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵
🧪 No relevant tests
🔒 No security concerns identified
 Recommended focus areas for review

New Enum Value

The new lvgl9Binary enum value has been added to PosterOutput. Ensure all parts of the application that process PosterOutput values are updated to correctly handle this new type, especially if it requires specific logic or conversion.

lvgl9Binary,
Default Values

Default values have been added for several fields in posterSchema, including width, height, count, orientation, shuffle, language, backgroundColor, format, and output. Verify that these default values are appropriate and align with the intended behavior for all use cases. Specifically, confirm ImageResizer.maxWidth and ImageResizer.maxHeight are correct for width and height, and that "de" is the desired default language.

'width': z.int().min(1, message: "'width' must be at least 1").max(4000, message: "'width' must be at most 4000").$default(ImageResizer.maxWidth),
'height': z.int().min(1, message: "'height' must be at least 1").max(4000, message: "'height' must be a most 4000").$default(ImageResizer.maxHeight),
'count': z.int().min(1, message: "'count' must be at least 1").max(20, message: "'count' must be at most 20").$default(4),
'orientation': z.string().refine(
  (value) => _orientations.contains(value),
  message: "'orientation' must be either ${_orientations.join(', ')}",
).$default(PosterOrientation.horizontal.name),
'shuffle': z.bool(message: "'shuffle' must be a boolean value").$default(true),
'language': z.string(message: "'language' must be a string").transform((value) => value.trim()).$default("de"),
'backgroundColor': z.string().regex(
  RegExp(r'^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$'),
  message: "The 'backgroundColor' must be a valid hexadecimal color code (e.g., #000 or #FF0000)",
).$default("#000000"),
'format': z.string().refine(
  (value) => _formats.contains(value),
  message: "'format' must be either ${_formats.join(', ')}",
).$default(PosterFormat.jpeg.name),
'output': z.string().refine(
  (value) => _outputs.contains(value),
  message: "'output' must be either ${_outputs.join(', ')}",
).$default(PosterOutput.lvgl9Binary.name),
Dependency Updates

Several dependencies have been updated (e.g., get_it, injectable, zard, build_runner, built_value_generator). While these are generally minor version bumps, it's important to ensure that these updates do not introduce any breaking changes or unexpected behavior. Thorough testing of the application's functionality is recommended.

  get_it: ^9.2.0
  image: ^4.5.4
  injectable: ^2.7.1+2
  shelf: ^1.4.2
  shelf_router: ^1.1.2
  shelf_web_socket: ^3.0.0
  zard: ^0.0.24

dev_dependencies:
  build_runner: ^2.10.4
  built_value_generator: ^8.12.1
  http: ^1.2.2
## PR Reviewer Guide 🔍 Here are some key observations to aid the review process: <table> <tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>: 3 🔵🔵🔵⚪⚪</td></tr> <tr><td>🧪&nbsp;<strong>No relevant tests</strong></td></tr> <tr><td>🔒&nbsp;<strong>No security concerns identified</strong></td></tr> <tr><td>⚡&nbsp;<strong>Recommended focus areas for review</strong><br><br> <details><summary><a href='https://git.mars3142.dev/model-railway/cinema-display/src/branch/feature/code_cleanup/server/cinema/lib/feature/poster/domain/poster.enums.dart#L15-L15'><strong>New Enum Value</strong></a> The new `lvgl9Binary` enum value has been added to `PosterOutput`. Ensure all parts of the application that process `PosterOutput` values are updated to correctly handle this new type, especially if it requires specific logic or conversion. </summary> ```dart lvgl9Binary, ``` </details> <details><summary><a href='https://git.mars3142.dev/model-railway/cinema-display/src/branch/feature/code_cleanup/server/cinema/lib/feature/poster/domain/poster_request.schema.dart#L10-L30'><strong>Default Values</strong></a> Default values have been added for several fields in `posterSchema`, including `width`, `height`, `count`, `orientation`, `shuffle`, `language`, `backgroundColor`, `format`, and `output`. Verify that these default values are appropriate and align with the intended behavior for all use cases. Specifically, confirm `ImageResizer.maxWidth` and `ImageResizer.maxHeight` are correct for `width` and `height`, and that "de" is the desired default language. </summary> ```dart 'width': z.int().min(1, message: "'width' must be at least 1").max(4000, message: "'width' must be at most 4000").$default(ImageResizer.maxWidth), 'height': z.int().min(1, message: "'height' must be at least 1").max(4000, message: "'height' must be a most 4000").$default(ImageResizer.maxHeight), 'count': z.int().min(1, message: "'count' must be at least 1").max(20, message: "'count' must be at most 20").$default(4), 'orientation': z.string().refine( (value) => _orientations.contains(value), message: "'orientation' must be either ${_orientations.join(', ')}", ).$default(PosterOrientation.horizontal.name), 'shuffle': z.bool(message: "'shuffle' must be a boolean value").$default(true), 'language': z.string(message: "'language' must be a string").transform((value) => value.trim()).$default("de"), 'backgroundColor': z.string().regex( RegExp(r'^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$'), message: "The 'backgroundColor' must be a valid hexadecimal color code (e.g., #000 or #FF0000)", ).$default("#000000"), 'format': z.string().refine( (value) => _formats.contains(value), message: "'format' must be either ${_formats.join(', ')}", ).$default(PosterFormat.jpeg.name), 'output': z.string().refine( (value) => _outputs.contains(value), message: "'output' must be either ${_outputs.join(', ')}", ).$default(PosterOutput.lvgl9Binary.name), ``` </details> <details><summary><a href='https://git.mars3142.dev/model-railway/cinema-display/src/branch/feature/code_cleanup/server/cinema/pubspec.yaml#L13-L24'><strong>Dependency Updates</strong></a> Several dependencies have been updated (e.g., `get_it`, `injectable`, `zard`, `build_runner`, `built_value_generator`). While these are generally minor version bumps, it's important to ensure that these updates do not introduce any breaking changes or unexpected behavior. Thorough testing of the application's functionality is recommended. </summary> ```yaml get_it: ^9.2.0 image: ^4.5.4 injectable: ^2.7.1+2 shelf: ^1.4.2 shelf_router: ^1.1.2 shelf_web_socket: ^3.0.0 zard: ^0.0.24 dev_dependencies: build_runner: ^2.10.4 built_value_generator: ^8.12.1 http: ^1.2.2 ``` </details> </td></tr> </table>
First-time contributor

PR Code Suggestions

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Define or replace undefined default values

The default values for width and height are set to ImageResizer.maxWidth and
ImageResizer.maxHeight. However, the provided diff does not show these static
properties being defined in the ImageResizer class, which will lead to a runtime
error. Consider defining these static properties in ImageResizer or using literal
values for the defaults.

server/cinema/lib/feature/poster/domain/poster_request.schema.dart [10-11]

-'width': z.int().min(1, message: "'width' must be at least 1").max(4000, message: "'width' must be at most 4000").$default(ImageResizer.maxWidth),
-'height': z.int().min(1, message: "'height' must be at least 1").max(4000, message: "'height' must be a most 4000").$default(ImageResizer.maxHeight),
+'width': z.int().min(1, message: "'width' must be at least 1").max(4000, message: "'width' must be at most 4000").$default(4000),
+'height': z.int().min(1, message: "'height' must be at least 1").max(4000, message: "'height' must be a most 4000").$default(4000),
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a potential runtime error because ImageResizer.maxWidth and ImageResizer.maxHeight are used as default values but are not defined in the provided ImageResizer class diff. This is a critical issue that would cause a crash.

High
## PR Code Suggestions ✨ <!-- b107e7c --> Explore these optional code suggestions: <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Define or replace undefined default values</summary> ___ **The default values for <code>width</code> and <code>height</code> are set to <code>ImageResizer.maxWidth</code> and <br><code>ImageResizer.maxHeight</code>. However, the provided diff does not show these static <br>properties being defined in the <code>ImageResizer</code> class, which will lead to a runtime <br>error. Consider defining these static properties in <code>ImageResizer</code> or using literal <br>values for the defaults.** [server/cinema/lib/feature/poster/domain/poster_request.schema.dart [10-11]](https://git.mars3142.dev/model-railway/cinema-display/src/branch/feature/code_cleanup/server/cinema/lib/feature/poster/domain/poster_request.schema.dart#L10-L11) ```diff -'width': z.int().min(1, message: "'width' must be at least 1").max(4000, message: "'width' must be at most 4000").$default(ImageResizer.maxWidth), -'height': z.int().min(1, message: "'height' must be at least 1").max(4000, message: "'height' must be a most 4000").$default(ImageResizer.maxHeight), +'width': z.int().min(1, message: "'width' must be at least 1").max(4000, message: "'width' must be at most 4000").$default(4000), +'height': z.int().min(1, message: "'height' must be at least 1").max(4000, message: "'height' must be a most 4000").$default(4000), ``` <details><summary>Suggestion importance[1-10]: 9</summary> __ Why: The suggestion correctly identifies a potential runtime error because `ImageResizer.maxWidth` and `ImageResizer.maxHeight` are used as default values but are not defined in the provided `ImageResizer` class diff. This is a critical issue that would cause a crash. </details></details></td><td align=center>High </td></tr></tr></tbody></table>
mars3142 merged commit efd34616b1 into main 2025-12-09 20:24:18 +00:00
mars3142 deleted branch feature/code_cleanup 2025-12-09 20:24:18 +00:00
Sign in to join this conversation.