creating first structure of cinema backend server
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:cinema/feature/poster/models/poster.enums.dart';
|
||||
import 'package:zard/zard.dart';
|
||||
|
||||
final _orientations = PosterOrientation.values.map((e) => e.name);
|
||||
final _formats = PosterFormat.values.map((e) => e.name);
|
||||
final _outputs = PosterOutput.values.map((e) => e.name);
|
||||
|
||||
final posterSchema = z.map({
|
||||
'width': z.int().min(1, message: "'width' must be at least 1").max(4000, message: "'width' must be at most 4000"),
|
||||
'height': z.int().min(1, message: "'height' must be at least 1").max(4000, message: "'height' must be a most 4000"),
|
||||
'count': z.int().min(1, message: "'count' must be at least 1").max(20, message: "'count' must be at most 20"),
|
||||
'orientation': z.string().refine(
|
||||
(value) => _orientations.contains(value),
|
||||
message: "'orientation' must be either ${_orientations.join(', ')}",
|
||||
),
|
||||
'shuffle': z.bool(message: "'shuffle' must be a boolean value"),
|
||||
'language': z.string(message: "'language' must be a string").transform((value) => value.trim()),
|
||||
'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)",
|
||||
),
|
||||
'format': z.string().refine(
|
||||
(value) => _formats.contains(value),
|
||||
message: "'format' must be either ${_formats.join(', ')}",
|
||||
),
|
||||
'output': z.string().refine(
|
||||
(value) => _outputs.contains(value),
|
||||
message: "'output' must be either ${_outputs.join(', ')}",
|
||||
),
|
||||
});
|
||||
Reference in New Issue
Block a user