Avoid D1 internal error in project lookup (#272)
This commit is contained in:
parent
d339f0c3d9
commit
b08cb0c9e2
@ -30,13 +30,18 @@ async function getProjectForOrganization(
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
) {
|
) {
|
||||||
return db.query.projects.findFirst({
|
const [project] = await db
|
||||||
where: and(
|
.select()
|
||||||
eq(projects.id, projectId),
|
.from(projects)
|
||||||
eq(projects.organizationId, organizationId),
|
.where(
|
||||||
isNull(projects.archivedAt),
|
and(
|
||||||
),
|
eq(projects.id, projectId),
|
||||||
});
|
eq(projects.organizationId, organizationId),
|
||||||
|
isNull(projects.archivedAt),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.limit(1);
|
||||||
|
return project ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createProject(
|
async function createProject(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user