Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit ee9d5de

Browse files
Blckbrry-PiNathanFlurry
authored andcommitted
eat: Create the auth_username_pasword module
1 parent 515a6d2 commit ee9d5de

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

modules/auth_username_password/tests/e2e.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ test("test_sign_in", async (ctx: TestContext) => {
5555
userToken: token.token,
5656
});
5757

58+
<<<<<<< HEAD
5859
const { users: [user] } = await ctx.modules.users.fetchByUsername({
60+
=======
61+
const { users: [user] } = await ctx.modules.users.fetchByUname({
62+
>>>>>>> 7d761a9 (eat: Create the `auth_username_pasword` module)
5963
usernames: [username],
6064
});
6165

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ScriptContext } from "../module.gen.ts";
2+
import { User } from "../utils/types.ts";
3+
4+
export interface Request {
5+
usernames: string[];
6+
}
7+
8+
export interface Response {
9+
users: User[];
10+
}
11+
12+
export async function run(
13+
ctx: ScriptContext,
14+
req: Request,
15+
): Promise<Response> {
16+
await ctx.modules.rateLimit.throttlePublic({});
17+
18+
const users = await ctx.db.user.findMany({
19+
where: { username: { in: req.usernames } },
20+
orderBy: { username: "desc" },
21+
});
22+
23+
return { users };
24+
}

tests/basic/backend.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@
7979
}
8080
}
8181
}
82-
}
82+
}

0 commit comments

Comments
 (0)