Casey Chow
10/08/2021, 5:24 PMEvan McDaniel
10/08/2021, 8:53 PMresolve
i have inside a Nexus createType
(or extendType
) function is showing basically the same TypeScript error. It’s not failing the compile, but I’m hoping to figure out how to solve the issue (no one likes red error warnings everywhere).
This is the error in my simple Query definition
Type '(_parent: {}, args: { accountId?: number; }, context: Context) => PrismaPromise<Application[]>' is not assignable to type 'FieldResolver<"Query", "applicationsByAccountId">'
And here’s the definition:Evan McDaniel
10/08/2021, 8:53 PMdefinition(t) {
t.nonNull.list.nonNull.field("applicationsByAccountId", {
type: "Application",
args: {
accountId: intArg()
},
resolve: (_parent, args, context: Context) => {
return context.prisma.account
.findUnique({
where: { id: args.accountId }
})
.applications();
}
});
}
Evan McDaniel
10/08/2021, 8:54 PMGabe O'Leary
10/09/2021, 12:44 AMconst statusResults = await prisma.status.groupBy({
by: ["url"],
where: {
AND: {
userIdStr: {
in: followIds,
},
createdAt: {
gte: startDate,
},
},
},
count: {
url: true,
},
// this orderBy doesn't seem to be working.
orderBy: {
count: {
url: "desc",
},
},
having: {
url: {
count: {
gt: 1,
},
},
},
});
Error:
TSError: ⨯ Unable to compile TypeScript:
script.ts:88:9 - error TS2322: Type '{ count: { url: string; }; }' is not assignable to type 'Enumerable<StatusOrderByInput> | undefined'.
Object literal may only specify known properties, and 'count' does not exist in type 'Enumerable<StatusOrderByInput>'.
I'm attempting to follow the example shown here and can't figure out where I'm going wrong.
Thanks!Gabe O'Leary
10/09/2021, 12:45 AM_count
used in some places and count
used in other places. What's the difference? should I be using one over the other?Alex Cavazos
10/09/2021, 1:37 AMMartin Benjamin
10/09/2021, 8:51 AMRicky Hopkins
10/09/2021, 9:51 AMCan't resolve '_http_common' in 'C:\Users\ricky\projects\spectr\server\node_modules\@prisma\client\runtime'
I can get around this by setting externals: ["_http_common"],
in my webpack.config, but when I go to run my build with node build/index.js
I get ReferenceError: _http_common is not defined
Anyone seen anything like this. Google is not too helpfuluser
10/09/2021, 10:16 AMJosh Fowler
10/09/2021, 1:04 PMQaiser Abbas
10/09/2021, 1:06 PMbashalir
10/09/2021, 3:51 PMTyler Clendenin
10/09/2021, 6:52 PMTyler Clendenin
10/09/2021, 8:07 PMEnumerable
typed properties so I can always deal with them as arrays? Same question with XOR
is there any helper methods to assist in working with it.
This relates to the above question because I am piping my upsert records into another stream processor to attempt to upsert any related records prior to running the upsert on the main records.Josh Fowler
10/09/2021, 10:49 PMSeren_Modz 21
10/10/2021, 4:43 AMconst leveling = await prisma.leveling.findMany({ orderBy: { totalXp: "desc" } })
const index = leveling.findIndex((l) => l.userId === user.id)
the problem with it, is that as the table scales, finding the index is going to become very slow as its fetching the whole table.user
10/10/2021, 10:00 AMJosh Fowler
10/10/2021, 9:03 PMSam
10/10/2021, 9:06 PMSELECT inviterId, count(*) as count FROM invites where serverId = ${member.guild.id} AND valid = 1 GROUP BY inviterId ORDER BY count DESC LIMIT 10
George Lewis
10/11/2021, 12:00 AMconst users = await ctx.prisma.user.findMany({
where: {
profile: {
firstName: {
contains: args.where.firstName
},
DOB: {
}
}
}})
Hi All, need your help .. I am trying to build a query that returns a list of users that have a birthday today .. there is a filed in the user model that has the DOB stored .. Is there anyway to do so?Tyler Clendenin
10/11/2021, 12:22 AMcreateMany
and create
with an array of objects?Seungsu Kim
10/11/2021, 3:23 AMSELECT ?
. Is it impossible to analyze prisma client executed queries by datadog or any other services?Kelechi Oliver
10/11/2021, 6:54 AMmodel User {
id String @id @default(uuid())
firstName String
lastName String
email String @unique
/// @TypeGraphQL.omit(output: true)
password String
accountType accountType @default(STUDENT)
role role @default(LEARNER)
profileStudent ProfileStudent?
profileTeacher ProfileTeacher?
....
}
I'm using Typegraphql Prisma
to generate types shown below,
@TypeGraphQL.ObjectType({
isAbstract: true
})
export class User {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
id!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
firstName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
lastName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
email!: string;
password?: string;
@TypeGraphQL.Field(_type => accountType, {
nullable: false
})
accountType!: "STUDENT" | "TEACHER";
@TypeGraphQL.Field(_type => role, {
nullable: false
})
role!: "ADMIN" | "INSTRUCTOR" | "LEARNER";
profileStudent?: ProfileStudent | null;
profileTeacher?: ProfileTeacher | null;
My problem is, the corresponding graphql schema generated does not include profileStudent
& profileTeacher
type User {
UserCohort: [UserCohort!]
UserSubject: [UserSubject!]
_count: UserCount
accountType: accountType!
createdAt: DateTime!
email: String!
firstName: String!
id: String!
lastName: String!
messagingId: String
role: role!
status: accountStatus!
token: String
updatedAt: DateTime!
}
does anyone have an idea what might be the issue?Zakaria
10/11/2021, 9:08 AMReuben Porter
10/11/2021, 11:18 AMskip
and limit
that doesn't include a separate count query in a transaction?dodgers
10/11/2021, 11:24 AMJens Dunzweiler
10/11/2021, 3:38 PMAugustus Chang
10/11/2021, 4:12 PMIbad Shaikh
10/11/2021, 8:37 PM