user.email account.plan_name - cleanup context and service construction - config for stripe callback - initial plan
This commit is contained in:
@@ -1,33 +1,27 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import prisma_client from '~~/prisma/prisma.client';
|
||||
|
||||
export default class NotesService {
|
||||
private prisma: PrismaClient;
|
||||
|
||||
constructor( prisma: PrismaClient) {
|
||||
this.prisma = prisma;
|
||||
}
|
||||
|
||||
async getAllNotes() {
|
||||
return this.prisma.note.findMany();
|
||||
return prisma_client.note.findMany();
|
||||
}
|
||||
|
||||
async getNoteById(id: number) {
|
||||
return this.prisma.note.findUniqueOrThrow({ where: { id } });
|
||||
return prisma_client.note.findUniqueOrThrow({ where: { id } });
|
||||
}
|
||||
|
||||
async getNotesForAccountId(account_id: number) {
|
||||
return this.prisma.note.findMany({ where: { account_id } });
|
||||
return prisma_client.note.findMany({ where: { account_id } });
|
||||
}
|
||||
|
||||
async createNote( account_id: number, note_text: string ) {
|
||||
return this.prisma.note.create({ data: { account_id, note_text }});
|
||||
return prisma_client.note.create({ data: { account_id, note_text }});
|
||||
}
|
||||
|
||||
async updateNote(id: number, note_text: string) {
|
||||
return this.prisma.note.update({ where: { id }, data: { note_text } });
|
||||
return prisma_client.note.update({ where: { id }, data: { note_text } });
|
||||
}
|
||||
|
||||
async deleteNote(id: number) {
|
||||
return this.prisma.note.delete({ where: { id } });
|
||||
return prisma_client.note.delete({ where: { id } });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user