mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 07:03:25 +00:00
update db col max size + add char to url regex
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `category` MODIFY `name` VARCHAR(255) NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `link` MODIFY `name` VARCHAR(255) NOT NULL,
|
||||||
|
MODIFY `url` TEXT NOT NULL;
|
||||||
@@ -20,7 +20,7 @@ model User {
|
|||||||
|
|
||||||
model Category {
|
model Category {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String @unique
|
name String @unique @db.VarChar(255)
|
||||||
links Link[]
|
links Link[]
|
||||||
nextCategoryId Int @default(0)
|
nextCategoryId Int @default(0)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
@@ -29,8 +29,8 @@ model Category {
|
|||||||
|
|
||||||
model Link {
|
model Link {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String
|
name String @db.VarChar(255)
|
||||||
url String
|
url String @db.Text
|
||||||
category Category @relation(fields: [categoryId], references: [id])
|
category Category @relation(fields: [categoryId], references: [id])
|
||||||
categoryId Int
|
categoryId Int
|
||||||
nextLinkId Int @default(0)
|
nextLinkId Int @default(0)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function BuildLink({ id, name, url, nextLinkId, favorite, createdAt, upda
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function IsValidURL(url: string): boolean {
|
export function IsValidURL(url: string): boolean {
|
||||||
const regex = new RegExp(/^(?:http(s)?:\/\/)[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/);
|
const regex = new RegExp(/^(?:http(s)?:\/\/)[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.\%]+$/);
|
||||||
return url.match(regex) ? true : false;
|
return url.match(regex) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user