Rene Nielsen
01/06/2022, 9:13 PMAlex Vilchis
01/06/2022, 9:34 PMAman Tiwari
01/09/2022, 9:40 PMconst enquiry = await db.enquiry.findFirst({
where: { id },
include: {
users: {
include: {
user: true,
},
},
},
})
if (!enquiry) throw new NotFoundError()
const partner = enquiry.users.filter((arr) => arr.user.role === "PARTNER")[0]
const customer = enquiry.users.filter((arr) => arr.user.role === "USER")[0]
return { ...enquiry, partner, customer }
Yusuf Erdogan
01/09/2022, 11:26 PMMoe Green
01/10/2022, 4:56 PMAlex Vilchis
01/10/2022, 6:47 PMjanguianof
01/12/2022, 11:28 PMRoewyn Umayam
01/13/2022, 7:42 PMTarun
01/17/2022, 7:15 AMMradul Jain
01/19/2022, 7:11 AMselect
cases.case_number as caseNumber,
inv.invNum,
inv.matNum,
cases.style,
cases.case_sk as caseSk
from fm_invoices_view inv
left join(
select case_number, case_sk, style from cases_details
) cases
on
SUBSTRING(cases.case_number, 0, CHARINDEX('-', cases.case_number)) = inv.matNum
where
inv.invNum = ${filter.invoiceId}
group by
inv.invNum,
cases.case_number,
cases.style,
inv.matNum,
cases.case_sk
Tim Saunders
01/21/2022, 2:43 PMNOT NULL
constraint? https://github.com/prisma/prisma/discussions/11307 Thanks for any wisdom/advice! Also, hello 👋Chonselgama Coulibaly
01/23/2022, 11:44 AMimport { Prisma } from "@prisma/client";
import { EntityStatusHistoryService } from "src/modules/task/services/entity-status-history.service";
import { EntityStatusService } from "src/modules/task/services/entity-status.service";
import { SaeiStatusEnum } from "src/utils/enums/saei-status.enum";
import { PrismaService } from "src/utils/prisma/prisma.service";
export function adjournApplicationStatusHistoryMiddleware(): Prisma.Middleware {
return async function (
params: Prisma.MiddlewareParams,
next: (params: Prisma.MiddlewareParams) => Promise<any>,
): Promise<Prisma.Middleware> {
if (params.model == 'Entity' && params.action == 'update') {
console.log("IN FIRST CONDITION");
const statusId = (
await new EntityStatusService(new PrismaService()).getEntityStatus(SaeiStatusEnum.AJOURNEE)
).id;
const lastEntityStatusHistory =
await new EntityStatusHistoryService(new PrismaService()).getLastEntityStatusHistory(
params.args.where.id,
);
if (
params.args.data.entityStatusId === statusId &&
lastEntityStatusHistory.statusId !== statusId
) {
console.log("IN SECOND CONDITION");
await new EntityStatusHistoryService(new PrismaService()).createEntityStatusHistory(statusId,params.args.where.id);
}
}
return next(params);
}
} ;
IN APP MODULE
import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TaskHandlerModule } from './modules/task/task.module';
import { PrismaModule } from "nestjs-prisma";
import { adjournApplicationStatusHistoryMiddleware } from './middleware/adjourn-application-status-history.middleware';
@Module({
imports: [
ScheduleModule.forRoot(),
TaskHandlerModule,
HttpModule,
PrismaModule.forRoot({
isGlobal: true,
prismaServiceOptions: {
middlewares: [adjournApplicationStatusHistoryMiddleware()],
prismaOptions: { log: ['info'] }
},
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
Alex Vilchis
01/24/2022, 7:02 PMpackage.json
scripts).
This is my first open source project so any feedback or suggestions are greatly appreciated. Thanks! prisma rainbow
https://github.com/arvindell/envfulJim Walker
02/01/2022, 9:34 PMAndrew Ross
02/02/2022, 1:27 PMtype UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
type SeedInferred = UnwrapPromise<ReturnType<typeof seed>>;
// experimenting
type SeedPropsInferred<U> = UnwrapPromise<
typeof seed extends Record<keyof U, infer U>
? Record<keyof U, U>
: UnwrapPromise<typeof seed>
>;
Len Smith
02/09/2022, 5:40 PMgql
string? I want to use the generated types, but there’s no guarantee we actually put the field in the query. Using the generated types, TypeScript tells us user.firstName
is guaranteed to exist, but it’s not in this case. Having to have a custom type for each query seems fragile, redundant and a lot of extra work, so I was wondering if there’re any solutions for this?Yusuf Erdogan
02/10/2022, 12:03 PMAlex Vilchis
02/11/2022, 5:58 PMSamrood Ali
02/16/2022, 3:10 PM{
"compilerOptions": {
"sourceMap": true,
"rootDir": "./",
"baseUrl": "./",
"outDir": "dist",
"target": "ES2018",
"module": "commonjs",
"strict": true,
"forceConsistentCasingInFileNames": true,
"lib": [
"esnext",
"DOM"
],
"esModuleInterop": true,
"paths": {
"*": [
"*",
"./src/declarations/*"
],
"#src/*": [
"./src/*"
],
"#routes/*": [
"./src/routes/*"
]
}
},
"exclude": [
"dist",
"node_modules"
],
"skipLibCheck": true,
"strictNullChecks": true
}
I love prisma though, huge fan.jt
02/16/2022, 10:28 PMRussell
02/18/2022, 10:28 AMSeif Lotfy
02/21/2022, 4:43 PMAlfred Noland
02/24/2022, 3:14 PMAlfred Noland
02/24/2022, 4:15 PMCatherine Laserna
03/02/2022, 11:27 PMTaishoKondo
03/13/2022, 7:08 AMChris Hinds
03/19/2022, 1:54 PMprisma1
which to me has a better syntax, seems to make things easier with MongoDB ie. auto matching of @id to _id
I think before I was using Prisma 2. However it seems like docs for Prisma 1 are still being updated and includes support for MongoDB etc
Am I just being daft here, and should I be using prisma 2. the datamodel.prisma
syntax seems much better IMO but this is on Prisma 1Omar
03/22/2022, 11:37 AMBreakpoint Bookmarks
, and it does exactly what it's name imply.
Basically you get to save all your breakpoints flows, and switch between them whenever you like, as you see in the gif.
You can also track those breakpoints files with your source controls tools of course.
You can download it with ext install OmarDulaimi.breakpoint-bookmarks
in command palette or from the extensions menu in vsCode.
I'm sure you noticed that I have used an official prisma example in the demo 🙂
Contributions are welcomed, you can find the repo here: https://github.com/omar-dulaimi/breakpoint-bookmarks
https://marketplace.visualstudio.com/items?itemName=OmarDulaimi.breakpoint-bookmarksBret emm
03/22/2022, 5:17 PMChris Bitoy
03/23/2022, 5:19 PM.env
file on github - I saved my db URL_STRINGS in my .env
, committed and pushed my changes to git. However, got a message from git that the info in my .env
file is exposed (see image). I have since destroyed the databases in question, but wondering if this is a bug cos its not supposed to act this way