M src/log/games.ts => src/log/games.ts +3 -3
@@ 1,5 1,5 @@
import { Input, Number, prompt } from "@cliffy/prompt";
-import { Entry } from "../schemas.ts";
+import { Entry, RATING_MAX, RATING_MIN } from "../schemas.ts";
import { getCurrentDate } from "../utils.ts";
export async function logGame(): Promise<Entry> {
@@ 36,8 36,8 @@ export async function logGame(): Promise<Entry> {
name: "rating",
message: "How many stars? (1-5)",
type: Number,
- min: 1,
- max: 5,
+ min: RATING_MIN,
+ max: RATING_MAX,
},
]);
M src/log/reading.ts => src/log/reading.ts +3 -1
@@ 1,7 1,7 @@
import { Input, List, Number, prompt, Select } from "@cliffy/prompt";
import { book } from "@timharek/openlibrary";
import { getCurrentDate, selectKeys } from "../utils.ts";
-import { Entry } from "../schemas.ts";
+import { Entry, RATING_MAX, RATING_MIN } from "../schemas.ts";
import { z } from "zod";
const titleAuthorSchema = z.object({
@@ 82,6 82,8 @@ export async function logRead(): Promise<Entry> {
name: "rating",
message: "How many stars? (1-5)",
type: Number,
+ min: RATING_MIN,
+ max: RATING_MAX,
},
]);
M src/log/watched.ts => src/log/watched.ts +3 -3
@@ 1,6 1,6 @@
import { Input, Number, prompt, Select } from "@cliffy/prompt";
import { Movie, TVShow } from "@timharek/tmdb";
-import { Entry } from "../schemas.ts";
+import { Entry, RATING_MAX, RATING_MIN } from "../schemas.ts";
import { getCurrentDate, selectKeys } from "../utils.ts";
import { z } from "zod";
@@ 57,8 57,8 @@ export async function logWatched(
name: "rating",
message: "How many stars? (1-5)",
type: Number,
- min: 1,
- max: 5,
+ min: RATING_MIN,
+ max: RATING_MAX,
},
]);