154 lines
3.1 KiB
TypeScript
154 lines
3.1 KiB
TypeScript
import { Aufnahme, BedarfsausweisGewerbe, BedarfsausweisWohnen, Bild, GEGNachweisGewerbe, GEGNachweisWohnen, Objekt, prisma, Rechnung, Unterlage, VerbrauchsausweisGewerbe, VerbrauchsausweisWohnen } from "./prisma.js";
|
|
|
|
export async function getVerbrauchsausweisWohnen(id: string): Promise<VerbrauchsausweisWohnen | null> {
|
|
return await prisma.verbrauchsausweisWohnen.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getVerbrauchsausweisWohnenKomplett(id: string) {
|
|
return await prisma.verbrauchsausweisWohnen.findUnique({
|
|
where: {
|
|
id
|
|
},
|
|
include: {
|
|
aufnahme: {
|
|
include: {
|
|
bilder: true,
|
|
objekt: {
|
|
include: {
|
|
benutzer: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
rechnung: true
|
|
},
|
|
})
|
|
}
|
|
|
|
export type VerbrauchsausweisWohnenKomplett = Awaited<ReturnType<typeof getVerbrauchsausweisWohnenKomplett>>;
|
|
|
|
export async function getVerbrauchsausweisGewerbe(id: string): Promise<VerbrauchsausweisGewerbe | null> {
|
|
return await prisma.verbrauchsausweisGewerbe.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getVerbrauchsausweisGewerbeKomplett(id: string) {
|
|
return await prisma.verbrauchsausweisGewerbe.findUnique({
|
|
where: {
|
|
id
|
|
},
|
|
include: {
|
|
aufnahme: {
|
|
include: {
|
|
bilder: true,
|
|
objekt: {
|
|
include: {
|
|
benutzer: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
rechnung: true
|
|
},
|
|
})
|
|
}
|
|
|
|
export async function getBedarfsausweisWohnen(id: string): Promise<BedarfsausweisWohnen | null> {
|
|
return await prisma.bedarfsausweisWohnen.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getBedarfsausweisWohnenKomplett(id: string) {
|
|
return await prisma.bedarfsausweisWohnen.findUnique({
|
|
where: {
|
|
id
|
|
},
|
|
include: {
|
|
aufnahme: {
|
|
include: {
|
|
bilder: true,
|
|
objekt: {
|
|
include: {
|
|
benutzer: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
rechnung: true
|
|
},
|
|
})
|
|
}
|
|
|
|
export async function getBedarfsausweisGewerbe(id: string): Promise<BedarfsausweisGewerbe | null> {
|
|
return await prisma.bedarfsausweisGewerbe.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getGEGNachweisWohnen(id: string): Promise<GEGNachweisWohnen | null> {
|
|
return await prisma.gEGNachweisWohnen.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getGEGNachweisGewerbe(id: string): Promise<GEGNachweisGewerbe | null> {
|
|
return await prisma.gEGNachweisGewerbe.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getAufnahme(id: string): Promise<Aufnahme | null> {
|
|
return await prisma.aufnahme.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getObjekt(id: string): Promise<Objekt | null> {
|
|
return await prisma.objekt.findUnique({
|
|
where: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getBilder(aufnahme_id: string): Promise<Bild[]> {
|
|
return await prisma.bild.findMany({
|
|
where: {
|
|
aufnahme_id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getUnterlagen(aufnahme_id: string): Promise<Unterlage[]> {
|
|
return await prisma.unterlage.findMany({
|
|
where: {
|
|
aufnahme_id
|
|
}
|
|
})
|
|
}
|
|
|
|
export async function getRechnung(rechnung_id: string) {
|
|
return await prisma.rechnung.findUnique({
|
|
where: {
|
|
id: rechnung_id
|
|
}
|
|
})
|
|
} |