mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-24 08:33:43 +00:00
chore: update Footer link to point to GitHub (#245)
This commit is contained in:
committed by
GitHub
parent
0e610d002c
commit
6fbb9aa9da
@@ -294,7 +294,7 @@ function FullWidthFooter() {
|
|||||||
<div className="flex items-center gap-1 text-sm max-w-7xl">
|
<div className="flex items-center gap-1 text-sm max-w-7xl">
|
||||||
<span>Powered by</span>
|
<span>Powered by</span>
|
||||||
<Link
|
<Link
|
||||||
href="http://kyantech.com.br"
|
href="https://github.com/kyantech"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="flex items-center hover:text-green-700 text-green-500 transition-colors font-light"
|
className="flex items-center hover:text-green-700 text-green-500 transition-colors font-light"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export function Footer() {
|
|||||||
<div className="flex items-center gap-1 text-sm ">
|
<div className="flex items-center gap-1 text-sm ">
|
||||||
<span>Powered by</span>
|
<span>Powered by</span>
|
||||||
<Link
|
<Link
|
||||||
href="http://kyantech.com.br"
|
href="https://github.com/kyantech"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="flex items-center hover:text-green-700 text-green-500 transition-colors font-light"
|
className="flex items-center hover:text-green-700 text-green-500 transition-colors font-light"
|
||||||
|
|||||||
@@ -1,245 +1,245 @@
|
|||||||
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { FolderController } from "./controller";
|
import { FolderController } from "./controller";
|
||||||
import {
|
import {
|
||||||
CheckFolderSchema,
|
CheckFolderSchema,
|
||||||
FolderResponseSchema,
|
FolderResponseSchema,
|
||||||
ListFoldersSchema,
|
ListFoldersSchema,
|
||||||
MoveFolderSchema,
|
MoveFolderSchema,
|
||||||
RegisterFolderSchema,
|
RegisterFolderSchema,
|
||||||
UpdateFolderSchema,
|
UpdateFolderSchema,
|
||||||
} from "./dto";
|
} from "./dto";
|
||||||
|
|
||||||
export async function folderRoutes(app: FastifyInstance) {
|
export async function folderRoutes(app: FastifyInstance) {
|
||||||
const folderController = new FolderController();
|
const folderController = new FolderController();
|
||||||
|
|
||||||
const preValidation = async (request: FastifyRequest, reply: FastifyReply) => {
|
const preValidation = async (request: FastifyRequest, reply: FastifyReply) => {
|
||||||
try {
|
try {
|
||||||
await request.jwtVerify();
|
await request.jwtVerify();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
reply.status(401).send({ error: "Token inválido ou ausente." });
|
reply.status(401).send({ error: "Token inválido ou ausente." });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
app.post(
|
app.post(
|
||||||
"/folders",
|
"/folders",
|
||||||
{
|
{
|
||||||
schema: {
|
schema: {
|
||||||
tags: ["Folder"],
|
tags: ["Folder"],
|
||||||
operationId: "registerFolder",
|
operationId: "registerFolder",
|
||||||
summary: "Register Folder Metadata",
|
summary: "Register Folder Metadata",
|
||||||
description: "Registers folder metadata in the database",
|
description: "Registers folder metadata in the database",
|
||||||
body: RegisterFolderSchema,
|
body: RegisterFolderSchema,
|
||||||
response: {
|
response: {
|
||||||
201: z.object({
|
201: z.object({
|
||||||
folder: z.object({
|
folder: z.object({
|
||||||
id: z.string().describe("The folder ID"),
|
id: z.string().describe("The folder ID"),
|
||||||
name: z.string().describe("The folder name"),
|
name: z.string().describe("The folder name"),
|
||||||
description: z.string().nullable().describe("The folder description"),
|
description: z.string().nullable().describe("The folder description"),
|
||||||
parentId: z.string().nullable().describe("The parent folder ID"),
|
parentId: z.string().nullable().describe("The parent folder ID"),
|
||||||
userId: z.string().describe("The user ID"),
|
userId: z.string().describe("The user ID"),
|
||||||
createdAt: z.date().describe("The folder creation date"),
|
createdAt: z.date().describe("The folder creation date"),
|
||||||
updatedAt: z.date().describe("The folder last update date"),
|
updatedAt: z.date().describe("The folder last update date"),
|
||||||
totalSize: z.string().optional().describe("The total size of the folder"),
|
totalSize: z.string().optional().describe("The total size of the folder"),
|
||||||
_count: z
|
_count: z
|
||||||
.object({
|
.object({
|
||||||
files: z.number().describe("Number of files in folder"),
|
files: z.number().describe("Number of files in folder"),
|
||||||
children: z.number().describe("Number of subfolders"),
|
children: z.number().describe("Number of subfolders"),
|
||||||
})
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Count statistics"),
|
.describe("Count statistics"),
|
||||||
}),
|
}),
|
||||||
message: z.string().describe("The folder registration message"),
|
message: z.string().describe("The folder registration message"),
|
||||||
}),
|
}),
|
||||||
400: z.object({ error: z.string().describe("Error message") }),
|
400: z.object({ error: z.string().describe("Error message") }),
|
||||||
401: z.object({ error: z.string().describe("Error message") }),
|
401: z.object({ error: z.string().describe("Error message") }),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
folderController.registerFolder.bind(folderController)
|
folderController.registerFolder.bind(folderController)
|
||||||
);
|
);
|
||||||
|
|
||||||
app.post(
|
app.post(
|
||||||
"/folders/check",
|
"/folders/check",
|
||||||
{
|
{
|
||||||
preValidation,
|
preValidation,
|
||||||
schema: {
|
schema: {
|
||||||
tags: ["Folder"],
|
tags: ["Folder"],
|
||||||
operationId: "checkFolder",
|
operationId: "checkFolder",
|
||||||
summary: "Check Folder validity",
|
summary: "Check Folder validity",
|
||||||
description: "Checks if the folder meets all requirements",
|
description: "Checks if the folder meets all requirements",
|
||||||
body: CheckFolderSchema,
|
body: CheckFolderSchema,
|
||||||
response: {
|
response: {
|
||||||
201: z.object({
|
201: z.object({
|
||||||
message: z.string().describe("The folder check success message"),
|
message: z.string().describe("The folder check success message"),
|
||||||
}),
|
}),
|
||||||
400: z.object({
|
400: z.object({
|
||||||
error: z.string().describe("Error message"),
|
error: z.string().describe("Error message"),
|
||||||
code: z.string().optional().describe("Error code"),
|
code: z.string().optional().describe("Error code"),
|
||||||
details: z.string().optional().describe("Error details"),
|
details: z.string().optional().describe("Error details"),
|
||||||
}),
|
}),
|
||||||
401: z.object({
|
401: z.object({
|
||||||
error: z.string().describe("Error message"),
|
error: z.string().describe("Error message"),
|
||||||
code: z.string().optional().describe("Error code"),
|
code: z.string().optional().describe("Error code"),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
folderController.checkFolder.bind(folderController)
|
folderController.checkFolder.bind(folderController)
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get(
|
app.get(
|
||||||
"/folders",
|
"/folders",
|
||||||
{
|
{
|
||||||
preValidation,
|
preValidation,
|
||||||
schema: {
|
schema: {
|
||||||
tags: ["Folder"],
|
tags: ["Folder"],
|
||||||
operationId: "listFolders",
|
operationId: "listFolders",
|
||||||
summary: "List Folders",
|
summary: "List Folders",
|
||||||
description: "Lists user folders recursively by default, optionally filtered by folder",
|
description: "Lists user folders recursively by default, optionally filtered by folder",
|
||||||
querystring: ListFoldersSchema,
|
querystring: ListFoldersSchema,
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folders: z.array(
|
folders: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
id: z.string().describe("The folder ID"),
|
id: z.string().describe("The folder ID"),
|
||||||
name: z.string().describe("The folder name"),
|
name: z.string().describe("The folder name"),
|
||||||
description: z.string().nullable().describe("The folder description"),
|
description: z.string().nullable().describe("The folder description"),
|
||||||
parentId: z.string().nullable().describe("The parent folder ID"),
|
parentId: z.string().nullable().describe("The parent folder ID"),
|
||||||
userId: z.string().describe("The user ID"),
|
userId: z.string().describe("The user ID"),
|
||||||
createdAt: z.date().describe("The folder creation date"),
|
createdAt: z.date().describe("The folder creation date"),
|
||||||
updatedAt: z.date().describe("The folder last update date"),
|
updatedAt: z.date().describe("The folder last update date"),
|
||||||
totalSize: z.string().optional().describe("The total size of the folder"),
|
totalSize: z.string().optional().describe("The total size of the folder"),
|
||||||
_count: z
|
_count: z
|
||||||
.object({
|
.object({
|
||||||
files: z.number().describe("Number of files in folder"),
|
files: z.number().describe("Number of files in folder"),
|
||||||
children: z.number().describe("Number of subfolders"),
|
children: z.number().describe("Number of subfolders"),
|
||||||
})
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Count statistics"),
|
.describe("Count statistics"),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
500: z.object({ error: z.string().describe("Error message") }),
|
500: z.object({ error: z.string().describe("Error message") }),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
folderController.listFolders.bind(folderController)
|
folderController.listFolders.bind(folderController)
|
||||||
);
|
);
|
||||||
|
|
||||||
app.patch(
|
app.patch(
|
||||||
"/folders/:id",
|
"/folders/:id",
|
||||||
{
|
{
|
||||||
preValidation,
|
preValidation,
|
||||||
schema: {
|
schema: {
|
||||||
tags: ["Folder"],
|
tags: ["Folder"],
|
||||||
operationId: "updateFolder",
|
operationId: "updateFolder",
|
||||||
summary: "Update Folder Metadata",
|
summary: "Update Folder Metadata",
|
||||||
description: "Updates folder metadata in the database",
|
description: "Updates folder metadata in the database",
|
||||||
params: z.object({
|
params: z.object({
|
||||||
id: z.string().min(1, "The folder id is required").describe("The folder ID"),
|
id: z.string().min(1, "The folder id is required").describe("The folder ID"),
|
||||||
}),
|
}),
|
||||||
body: UpdateFolderSchema,
|
body: UpdateFolderSchema,
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folder: z.object({
|
folder: z.object({
|
||||||
id: z.string().describe("The folder ID"),
|
id: z.string().describe("The folder ID"),
|
||||||
name: z.string().describe("The folder name"),
|
name: z.string().describe("The folder name"),
|
||||||
description: z.string().nullable().describe("The folder description"),
|
description: z.string().nullable().describe("The folder description"),
|
||||||
parentId: z.string().nullable().describe("The parent folder ID"),
|
parentId: z.string().nullable().describe("The parent folder ID"),
|
||||||
userId: z.string().describe("The user ID"),
|
userId: z.string().describe("The user ID"),
|
||||||
createdAt: z.date().describe("The folder creation date"),
|
createdAt: z.date().describe("The folder creation date"),
|
||||||
updatedAt: z.date().describe("The folder last update date"),
|
updatedAt: z.date().describe("The folder last update date"),
|
||||||
totalSize: z.string().optional().describe("The total size of the folder"),
|
totalSize: z.string().optional().describe("The total size of the folder"),
|
||||||
_count: z
|
_count: z
|
||||||
.object({
|
.object({
|
||||||
files: z.number().describe("Number of files in folder"),
|
files: z.number().describe("Number of files in folder"),
|
||||||
children: z.number().describe("Number of subfolders"),
|
children: z.number().describe("Number of subfolders"),
|
||||||
})
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Count statistics"),
|
.describe("Count statistics"),
|
||||||
}),
|
}),
|
||||||
message: z.string().describe("Success message"),
|
message: z.string().describe("Success message"),
|
||||||
}),
|
}),
|
||||||
400: z.object({ error: z.string().describe("Error message") }),
|
400: z.object({ error: z.string().describe("Error message") }),
|
||||||
401: z.object({ error: z.string().describe("Error message") }),
|
401: z.object({ error: z.string().describe("Error message") }),
|
||||||
403: z.object({ error: z.string().describe("Error message") }),
|
403: z.object({ error: z.string().describe("Error message") }),
|
||||||
404: z.object({ error: z.string().describe("Error message") }),
|
404: z.object({ error: z.string().describe("Error message") }),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
folderController.updateFolder.bind(folderController)
|
folderController.updateFolder.bind(folderController)
|
||||||
);
|
);
|
||||||
|
|
||||||
app.put(
|
app.put(
|
||||||
"/folders/:id/move",
|
"/folders/:id/move",
|
||||||
{
|
{
|
||||||
preValidation,
|
preValidation,
|
||||||
schema: {
|
schema: {
|
||||||
tags: ["Folder"],
|
tags: ["Folder"],
|
||||||
operationId: "moveFolder",
|
operationId: "moveFolder",
|
||||||
summary: "Move Folder",
|
summary: "Move Folder",
|
||||||
description: "Moves a folder to a different parent folder",
|
description: "Moves a folder to a different parent folder",
|
||||||
params: z.object({
|
params: z.object({
|
||||||
id: z.string().min(1, "The folder id is required").describe("The folder ID"),
|
id: z.string().min(1, "The folder id is required").describe("The folder ID"),
|
||||||
}),
|
}),
|
||||||
body: MoveFolderSchema,
|
body: MoveFolderSchema,
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folder: z.object({
|
folder: z.object({
|
||||||
id: z.string().describe("The folder ID"),
|
id: z.string().describe("The folder ID"),
|
||||||
name: z.string().describe("The folder name"),
|
name: z.string().describe("The folder name"),
|
||||||
description: z.string().nullable().describe("The folder description"),
|
description: z.string().nullable().describe("The folder description"),
|
||||||
parentId: z.string().nullable().describe("The parent folder ID"),
|
parentId: z.string().nullable().describe("The parent folder ID"),
|
||||||
userId: z.string().describe("The user ID"),
|
userId: z.string().describe("The user ID"),
|
||||||
createdAt: z.date().describe("The folder creation date"),
|
createdAt: z.date().describe("The folder creation date"),
|
||||||
updatedAt: z.date().describe("The folder last update date"),
|
updatedAt: z.date().describe("The folder last update date"),
|
||||||
totalSize: z.string().optional().describe("The total size of the folder"),
|
totalSize: z.string().optional().describe("The total size of the folder"),
|
||||||
_count: z
|
_count: z
|
||||||
.object({
|
.object({
|
||||||
files: z.number().describe("Number of files in folder"),
|
files: z.number().describe("Number of files in folder"),
|
||||||
children: z.number().describe("Number of subfolders"),
|
children: z.number().describe("Number of subfolders"),
|
||||||
})
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Count statistics"),
|
.describe("Count statistics"),
|
||||||
}),
|
}),
|
||||||
message: z.string().describe("Success message"),
|
message: z.string().describe("Success message"),
|
||||||
}),
|
}),
|
||||||
400: z.object({ error: z.string().describe("Error message") }),
|
400: z.object({ error: z.string().describe("Error message") }),
|
||||||
401: z.object({ error: z.string().describe("Error message") }),
|
401: z.object({ error: z.string().describe("Error message") }),
|
||||||
403: z.object({ error: z.string().describe("Error message") }),
|
403: z.object({ error: z.string().describe("Error message") }),
|
||||||
404: z.object({ error: z.string().describe("Error message") }),
|
404: z.object({ error: z.string().describe("Error message") }),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
folderController.moveFolder.bind(folderController)
|
folderController.moveFolder.bind(folderController)
|
||||||
);
|
);
|
||||||
|
|
||||||
app.delete(
|
app.delete(
|
||||||
"/folders/:id",
|
"/folders/:id",
|
||||||
{
|
{
|
||||||
preValidation,
|
preValidation,
|
||||||
schema: {
|
schema: {
|
||||||
tags: ["Folder"],
|
tags: ["Folder"],
|
||||||
operationId: "deleteFolder",
|
operationId: "deleteFolder",
|
||||||
summary: "Delete Folder",
|
summary: "Delete Folder",
|
||||||
description: "Deletes a folder and all its contents",
|
description: "Deletes a folder and all its contents",
|
||||||
params: z.object({
|
params: z.object({
|
||||||
id: z.string().min(1, "The folder id is required").describe("The folder ID"),
|
id: z.string().min(1, "The folder id is required").describe("The folder ID"),
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string().describe("The folder deletion message"),
|
message: z.string().describe("The folder deletion message"),
|
||||||
}),
|
}),
|
||||||
400: z.object({ error: z.string().describe("Error message") }),
|
400: z.object({ error: z.string().describe("Error message") }),
|
||||||
401: z.object({ error: z.string().describe("Error message") }),
|
401: z.object({ error: z.string().describe("Error message") }),
|
||||||
404: z.object({ error: z.string().describe("Error message") }),
|
404: z.object({ error: z.string().describe("Error message") }),
|
||||||
500: z.object({ error: z.string().describe("Error message") }),
|
500: z.object({ error: z.string().describe("Error message") }),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
folderController.deleteFolder.bind(folderController)
|
folderController.deleteFolder.bind(folderController)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user