Skip to content

Commit

Permalink
feat: add tspattern
Browse files Browse the repository at this point in the history
  • Loading branch information
zekhoi committed Aug 31, 2024
1 parent a063550 commit ddd602c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"react-dom": "^18",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"ts-pattern": "^5.3.1",
"uuid": "^10.0.0",
"zod": "^3.23.8"
},
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function AllReferenceTable() {
<CardHeader className='flex flex-row items-center'>
<div className='grid gap-2'>
<CardTitle>References</CardTitle>
<CardDescription>Recent added</CardDescription>
<CardDescription>Recently added.</CardDescription>
</div>
<Button asChild size='sm' className='ml-auto gap-1'>
<Link href='#'>
Expand Down
1 change: 1 addition & 0 deletions src/lib/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './auth.action';
export * from './references.action';
export * from './roles.action';
export * from './users.action';
23 changes: 23 additions & 0 deletions src/lib/actions/references.action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';

import { desc } from 'drizzle-orm';

import { checkAdmin } from '@/lib/auth';

import { database, reference } from '@/database';

export async function getReferences() {
const { isAdmin } = await checkAdmin();

if (!isAdmin) {
return [];
}

return await database
.select()
.from(reference)
// .where(
// and(search.name ? ilike(reference.name, search.name) : undefined),
// )
.orderBy(desc(reference.createdAt));
}

0 comments on commit ddd602c

Please sign in to comment.