mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +00:00
Compare commits
2 Commits
fb0345bf68
...
af08964fcc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af08964fcc | ||
|
|
151ac0602a |
@@ -15,9 +15,6 @@ export default class Collection extends AppBaseModel {
|
||||
@column()
|
||||
declare visibility: Visibility;
|
||||
|
||||
@column()
|
||||
declare nextId: number;
|
||||
|
||||
@column()
|
||||
declare authorId: number;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ export const createCollectionValidator = vine.compile(
|
||||
name: vine.string().trim().minLength(1).maxLength(254),
|
||||
description: vine.string().trim().maxLength(254).nullable(),
|
||||
visibility: vine.enum(Visibility),
|
||||
nextId: vine.number().optional(),
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ export const updateCollectionValidator = vine.compile(
|
||||
name: vine.string().trim().minLength(1).maxLength(254),
|
||||
description: vine.string().trim().maxLength(254).nullable(),
|
||||
visibility: vine.enum(Visibility),
|
||||
nextId: vine.number().optional(),
|
||||
|
||||
params,
|
||||
})
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { BaseSchema } from '@adonisjs/lucid/schema';
|
||||
|
||||
export default class extends BaseSchema {
|
||||
protected tableName = 'collections';
|
||||
|
||||
async up() {
|
||||
this.schema.alterTable('collections', (table) => {
|
||||
table.dropColumn('next_id');
|
||||
});
|
||||
}
|
||||
|
||||
async down() {
|
||||
this.schema.alterTable('collections', (table) => {
|
||||
table
|
||||
.integer('next_id')
|
||||
.references('id')
|
||||
.inTable('collections')
|
||||
.defaultTo(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ function createRandomCollection(userIds: User['id'][]) {
|
||||
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
||||
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
||||
visibility: Visibility.PRIVATE,
|
||||
nextId: collectionId + 1,
|
||||
authorId,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,13 +3,12 @@ import { FormEvent } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import BackToDashboard from '~/components/common/navigation/back_to_dashboard';
|
||||
import { FormLayout, FormLayoutProps } from '~/layouts/form_layout';
|
||||
import { Collection, Visibility } from '~/types/app';
|
||||
import { Visibility } from '~/types/app';
|
||||
|
||||
export type FormCollectionData = {
|
||||
name: string;
|
||||
description: string | null;
|
||||
visibility: Visibility;
|
||||
nextId?: Collection['id'];
|
||||
};
|
||||
|
||||
interface FormCollectionProps extends FormLayoutProps {
|
||||
|
||||
@@ -18,7 +18,6 @@ export default function EditCollectionPage({
|
||||
name: collection.name,
|
||||
description: collection.description,
|
||||
visibility: collection.visibility,
|
||||
nextId: collection.nextId,
|
||||
});
|
||||
const canSubmit = useMemo<boolean>(() => {
|
||||
const trimmedName = data.name.trim();
|
||||
|
||||
@@ -49,7 +49,6 @@ export type Collection = CommonBase & {
|
||||
name: string;
|
||||
description: string | null;
|
||||
visibility: Visibility;
|
||||
nextId: number;
|
||||
authorId: number;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "my-links",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user