Skip to content

Commit

Permalink
added source filetype and rm eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
harishdeivanayagam committed Jan 10, 2025
1 parent 73f4f04 commit b0b34c2
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
eslint: {
ignoreDuringBuilds: true,
},
};

export default nextConfig;
16 changes: 16 additions & 0 deletions prisma/migrations/20250110112752_source_column_types/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
Warnings:
- You are about to drop the column `filename` on the `Source` table. All the data in the column will be lost.
- You are about to drop the column `nickname` on the `Source` table. All the data in the column will be lost.
- Added the required column `fileName` to the `Source` table without a default value. This is not possible if the table is not empty.
- Added the required column `fileType` to the `Source` table without a default value. This is not possible if the table is not empty.
- Added the required column `nickName` to the `Source` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Source" DROP COLUMN "filename",
DROP COLUMN "nickname",
ADD COLUMN "fileName" TEXT NOT NULL,
ADD COLUMN "fileType" TEXT NOT NULL,
ADD COLUMN "nickName" TEXT NOT NULL;
5 changes: 3 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ model Sheet {

model Source {
id String @id @default(uuid())
filename String
nickname String
fileName String
fileType String
nickName String
isIndexed Boolean @default(false)
organizationId String
organization Organization @relation(fields: [organizationId], references: [id])
Expand Down
4 changes: 2 additions & 2 deletions src/app/console/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ export async function getUploadUrlForSource(filename: string) {
}
}

export async function addSource(name: string, filename: string) {
export async function addSource(nickName: string, fileName: string, fileType: string) {
const { organizationId } = await getAuthToken()
await prisma.source.create({
data: { nickname: name, filename, organizationId },
data: { nickName, fileName, fileType, organizationId },
})

return
Expand Down
2 changes: 1 addition & 1 deletion src/app/console/sheets/[slug]/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const fetchSheet = async (id: string) => {
source: {
select: {
id: true,
nickname: true
nickName: true
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/console/sheets/[slug]/sourcesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function SourcesDialog({ sheetId, onAdd }: { sheetId: string, onA
}

const filteredSources = sources.filter(source =>
source.nickname.toLowerCase().includes(search.toLowerCase())
source.nickName.toLowerCase().includes(search.toLowerCase())
)

return (
Expand All @@ -56,7 +56,7 @@ export default function SourcesDialog({ sheetId, onAdd }: { sheetId: string, onA
<div key={source.id} className="flex border-[1px] border-gray-200 rounded-md p-5 justify-between">
<div className="flex items-center gap-2">
<PiFile size={20} />
<p className="text-sm">{source.nickname}</p>
<p className="text-sm">{source.nickName}</p>
<p className="text-xs px-1 py-0.5 bg-gray-200 rounded-md">{source.isIndexed ? "Indexed" : "Not indexed"}</p>
</div>
<Button disabled={!source.isIndexed} size="icon" onClick={() => handleSelect(source.id)}>{selectedSources.includes(source.id) || sheetSources.includes(source.id) ? <PiX /> : <PiCheck />}</Button>
Expand Down
6 changes: 3 additions & 3 deletions src/app/console/sourcesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function SourcesDialog() {
await instance.put(url, file)

// Save source in database
await addSource(file.name, filename)
await addSource(file.name, filename, file.type)

// Refresh sources list
await fetchData()
Expand Down Expand Up @@ -73,7 +73,7 @@ export default function SourcesDialog() {
}

const filteredSources = sources.filter(source =>
source.nickname.toLowerCase().includes(search.toLowerCase())
source.nickName.toLowerCase().includes(search.toLowerCase())
)

return (
Expand All @@ -100,7 +100,7 @@ export default function SourcesDialog() {
<div key={source.id} className="flex border-[1px] border-gray-200 rounded-md p-5 justify-between">
<div className="flex items-center gap-2">
<PiFile size={20} />
<p className="text-sm">{source.nickname}</p>
<p className="text-sm">{source.nickName}</p>
<p className="text-xs px-1 py-0.5 bg-gray-200 rounded-md">{source.isIndexed ? 'Indexed' : 'Not indexed'}</p>
</div>
<Button variant="destructive" size="icon" onClick={() => handleDelete(source.id)}><PiTrash /></Button>
Expand Down

0 comments on commit b0b34c2

Please sign in to comment.