Linting.
This commit is contained in:
parent
6cf79c322d
commit
68578c47d6
7 changed files with 23 additions and 24 deletions
|
|
@ -16,7 +16,7 @@ module.exports = {
|
|||
{ name: 'projects', hasUid: false },
|
||||
{ name: 'notes', hasUid: false },
|
||||
{ name: 'tags', hasUid: false },
|
||||
{ name: 'tasks', hasUid: false } // Keep existing uuid column, add new uid column
|
||||
{ name: 'tasks', hasUid: false }, // Keep existing uuid column, add new uid column
|
||||
];
|
||||
|
||||
// 1. Add uid columns to all tables
|
||||
|
|
@ -65,7 +65,6 @@ module.exports = {
|
|||
name: `${table.name}_uid_unique_index`,
|
||||
});
|
||||
}
|
||||
|
||||
} finally {
|
||||
// Re-enable foreign key constraints
|
||||
await queryInterface.sequelize.query('PRAGMA foreign_keys = ON');
|
||||
|
|
@ -75,20 +74,28 @@ module.exports = {
|
|||
async down(queryInterface, Sequelize) {
|
||||
// Remove unique indexes and uid columns
|
||||
const tables = ['areas', 'projects', 'notes', 'tags', 'tasks'];
|
||||
|
||||
|
||||
for (const tableName of tables) {
|
||||
try {
|
||||
await queryInterface.removeIndex(tableName, `${tableName}_uid_unique_index`);
|
||||
await queryInterface.removeIndex(
|
||||
tableName,
|
||||
`${tableName}_uid_unique_index`
|
||||
);
|
||||
} catch (error) {
|
||||
// Index might not exist
|
||||
console.log(`${tableName}_uid_unique_index not found, skipping removal`);
|
||||
console.log(
|
||||
`${tableName}_uid_unique_index not found, skipping removal`
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
await queryInterface.removeColumn(tableName, 'uid');
|
||||
} catch (error) {
|
||||
console.log(`Error removing uid column from ${tableName}:`, error.message);
|
||||
console.log(
|
||||
`Error removing uid column from ${tableName}:`,
|
||||
error.message
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -893,11 +893,13 @@ router.get('/tasks', async (req, res) => {
|
|||
router.get('/task', async (req, res) => {
|
||||
try {
|
||||
const { uid } = req.query;
|
||||
|
||||
|
||||
if (_.isEmpty(uid)) {
|
||||
return res.status(400).json({ error: 'uid query parameter is required' });
|
||||
return res
|
||||
.status(400)
|
||||
.json({ error: 'uid query parameter is required' });
|
||||
}
|
||||
|
||||
|
||||
const task = await Task.findOne({
|
||||
where: { uid: uid, user_id: req.currentUser.id },
|
||||
include: [
|
||||
|
|
@ -927,7 +929,6 @@ router.get('/task', async (req, res) => {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
// GET /api/task/:id
|
||||
router.get('/task/:id', async (req, res) => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -482,9 +482,7 @@ export const useStore = create<StoreState>((set: any) => ({
|
|||
set((state) => ({
|
||||
tasksStore: {
|
||||
...state.tasksStore,
|
||||
tasks: state.tasksStore.tasks.some(
|
||||
(t) => t.uid === uid
|
||||
)
|
||||
tasks: state.tasksStore.tasks.some((t) => t.uid === uid)
|
||||
? state.tasksStore.tasks.map((t) =>
|
||||
t.uid === uid ? task : t
|
||||
)
|
||||
|
|
|
|||
|
|
@ -103,9 +103,7 @@ export const deleteProject = async (projectId: number): Promise<void> => {
|
|||
await handleAuthResponse(response, 'Failed to delete project.');
|
||||
};
|
||||
|
||||
export const fetchProjectBySlug = async (
|
||||
uidSlug: string
|
||||
): Promise<Project> => {
|
||||
export const fetchProjectBySlug = async (uidSlug: string): Promise<Project> => {
|
||||
const response = await fetch(`/api/project/${uidSlug}`, {
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -95,10 +95,7 @@ export function createProjectUrl(project: {
|
|||
* @param note - Note object with uid and title
|
||||
* @returns The note URL path (e.g., "/note/abc123-meeting-notes")
|
||||
*/
|
||||
export function createNoteUrl(note: {
|
||||
uid?: string;
|
||||
title: string;
|
||||
}): string {
|
||||
export function createNoteUrl(note: { uid?: string; title: string }): string {
|
||||
if (!note.uid) {
|
||||
throw new Error('Note uid is required');
|
||||
}
|
||||
|
|
@ -118,4 +115,3 @@ export function createTagUrl(tag: { uid?: string; name: string }): string {
|
|||
const uidSlug = createUidSlug(tag.uid, tag.name);
|
||||
return `/tag/${uidSlug}`;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export const deleteTag = async (tagId: number): Promise<void> => {
|
|||
export const fetchTagBySlug = async (uidSlug: string): Promise<Tag> => {
|
||||
// Extract uid from uidSlug using proper extraction function
|
||||
const uid = extractUidFromSlug(uidSlug);
|
||||
|
||||
|
||||
const response = await fetch(`/api/tag?uid=${encodeURIComponent(uid)}`, {
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ export const fetchTaskByUid = async (uid: string): Promise<Task> => {
|
|||
return await response.json();
|
||||
};
|
||||
|
||||
|
||||
export const fetchSubtasks = async (parentTaskId: number): Promise<Task[]> => {
|
||||
const response = await fetch(`/api/task/${parentTaskId}/subtasks`, {
|
||||
credentials: 'include',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue