Skip to content

Commit

Permalink
rename basObj
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanKiral committed Aug 26, 2024
1 parent 4b586c7 commit a46b9d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/commands/migrations/run/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,19 @@ const runMigrationsCli = async (params: RunMigrationsCliParams) => {
const resolveParams = (
params: RunMigrationsCliParams,
): WithErr<RunMigrationsParams> => {
const baseObj = { next: undefined, name: undefined, range: undefined, all: undefined };
const emptyParams = { next: undefined, name: undefined, range: undefined, all: undefined };

return match(params)
.returnType<WithErr<RunMigrationsParams>>()
.with({ next: P.nonNullable }, ({ next }) => ({ value: { ...params, ...baseObj, next } }))
.with({ next: P.nonNullable }, ({ next }) => ({ value: { ...params, ...emptyParams, next } }))
.with({ range: P.nonNullable }, ({ range }) => {
const parsedRange = parseRange(range as string);
if ("err" in parsedRange) {
return parsedRange;
}
return { value: { ...params, ...baseObj, range: parsedRange.value } };
return { value: { ...params, ...emptyParams, range: parsedRange.value } };
})
.with({ name: P.nonNullable }, ({ name }) => ({ value: { ...params, ...baseObj, name } }))
.with({ all: P.nonNullable }, ({ all }) => ({ value: { ...params, ...baseObj, all } }))
.with({ name: P.nonNullable }, ({ name }) => ({ value: { ...params, ...emptyParams, name } }))
.with({ all: P.nonNullable }, ({ all }) => ({ value: { ...params, ...emptyParams, all } }))
.otherwise(() => ({ err: "Invalid parameters" }));
};

0 comments on commit a46b9d3

Please sign in to comment.