clients page

This commit is contained in:
Dimitar765 committed 2024-10-29 06:47:15 +01:00
1 parent 3d2b0a5d6d
commit 1a7f2afd79
20 files changed
+458 -402

No files matched your search

@@ -1,14 +1,33 @@
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { Document } from '@prisma/client';
//import { Document } from '@prisma/client';
@Injectable()
export class DocumentsService {
constructor(private readonly prisma: PrismaService) {}
async findAllForClient(clientId: number): Promise<Document[]> {
async getClientDocuments(clientId: number) {
// return this.prisma.document.findMany({
// where: {
// sharedWithId: clientId,
// },
// include: {
// sharedWith: {
// select: {
// id: true,
// name: true,
// email: true,
// },
// },
// },
// });
return this.prisma.document.findMany({
where: { authorId: clientId },
where: {
sharedWithId: clientId,
},
orderBy: {
createdAt: 'desc',
},
});
}
}