mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +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 {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
name String @unique @db.VarChar(255)
|
||||
links Link[]
|
||||
nextCategoryId Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
@@ -29,8 +29,8 @@ model Category {
|
||||
|
||||
model Link {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
url String
|
||||
name String @db.VarChar(255)
|
||||
url String @db.Text
|
||||
category Category @relation(fields: [categoryId], references: [id])
|
||||
categoryId Int
|
||||
nextLinkId Int @default(0)
|
||||
|
||||
@@ -29,7 +29,7 @@ export function BuildLink({ id, name, url, nextLinkId, favorite, createdAt, upda
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user