Compare commits
20 Commits
v0.3.0
...
feat/dashb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7062f8cfb | ||
|
|
40f40a0329 | ||
|
|
4bc1cc1eda | ||
|
|
3743fcd88d | ||
|
|
8fb1da8224 | ||
|
|
a6946094f3 | ||
|
|
e3b25abccb | ||
|
|
74a0dc2fc0 | ||
|
|
6c6fd4bd32 | ||
|
|
09066fa47d | ||
|
|
089723d748 | ||
|
|
18c7faac19 | ||
|
|
076fe1d922 | ||
|
|
c58c8c753c | ||
|
|
789b48b715 | ||
|
|
9feb2d3d07 | ||
|
|
54479764f6 | ||
|
|
5c12221f09 | ||
|
|
b9c3ffe7ab | ||
|
|
63d948cc06 |
@@ -166,19 +166,9 @@ export const initAuth = (db: dbClient) => {
|
|||||||
databaseHooks: {
|
databaseHooks: {
|
||||||
user: {
|
user: {
|
||||||
create: {
|
create: {
|
||||||
async before(user) {
|
before() {
|
||||||
if (env("NEXT_PUBLIC_DISABLE_SIGN_UP")?.toLowerCase() === "true") {
|
if (env("NEXT_PUBLIC_DISABLE_SIGN_UP")?.toLowerCase() === "true") {
|
||||||
const pendingInvitation = await memberRepo.getByEmailAndStatus(
|
return Promise.resolve(false);
|
||||||
db,
|
|
||||||
user.email,
|
|
||||||
"invited",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!pendingInvitation) {
|
|
||||||
return Promise.resolve(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.resolve(true);
|
|
||||||
}
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -41,20 +41,6 @@ export const getByPublicId = async (db: dbClient, publicId: string) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getByEmailAndStatus = async (
|
|
||||||
db: dbClient,
|
|
||||||
email: string,
|
|
||||||
status: MemberStatus,
|
|
||||||
) => {
|
|
||||||
return db.query.workspaceMembers.findFirst({
|
|
||||||
where: and(
|
|
||||||
eq(workspaceMembers.email, email),
|
|
||||||
eq(workspaceMembers.status, status),
|
|
||||||
isNull(workspaceMembers.deletedAt),
|
|
||||||
),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const acceptInvite = async (
|
export const acceptInvite = async (
|
||||||
db: dbClient,
|
db: dbClient,
|
||||||
args: { memberId: number; userId: string },
|
args: { memberId: number; userId: string },
|
||||||
|
|||||||
Reference in New Issue
Block a user