-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix base & table name should not contains space
- Loading branch information
Showing
9 changed files
with
33 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { ValueObject } from "@undb/domain" | ||
import * as z from "@undb/zod" | ||
|
||
export const baseNameSchema = z.string().min(1) | ||
export const baseNameSchema = z | ||
.string() | ||
.min(1) | ||
.regex(/^[^\s]*$/, "Base name cannot contain spaces") | ||
|
||
export class BaseName extends ValueObject<z.infer<typeof baseNameSchema>> { | ||
static from(name: string): BaseName { | ||
return new BaseName({ value: name }) | ||
return new BaseName({ value: baseNameSchema.parse(name) }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { ValueObject } from "@undb/domain" | ||
import { z } from "@undb/zod" | ||
|
||
export const tableName = z.string().min(2, { message: "table name contains at least 2 chars" }) | ||
export const tableName = z | ||
.string() | ||
.min(2, { message: "table name contains at least 2 chars" }) | ||
.regex(/^[^\s]*$/, "Table name cannot contain spaces") | ||
|
||
export type ITableName = z.infer<typeof tableName> | ||
|
||
export class TableNameVo extends ValueObject { | ||
constructor(value: string) { | ||
super({ value }) | ||
super({ value: tableName.parse(value) }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters