user.email account.plan_name - cleanup context and service construction - config for stripe callback - initial plan

This commit is contained in:
Michael Dausmann
2023-03-19 15:48:08 +11:00
parent 4959475dcc
commit 45fb639fcf
12 changed files with 81 additions and 86 deletions

View File

@@ -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 } });
}
}