feat(server): get public user by id (#10434)

close CLOUD-160
This commit is contained in:
fengmk2
2025-03-06 15:25:06 +00:00
parent 7302c4f954
commit 289d3cd20e
13 changed files with 184 additions and 26 deletions
@@ -152,6 +152,7 @@ test('should get public user by id', async t => {
t.not(publicUser, null);
t.is(publicUser!.id, user.id);
t.true(!('password' in publicUser!));
t.true(!('email' in publicUser!));
});
test('should get public user by email', async t => {
@@ -164,6 +165,35 @@ test('should get public user by email', async t => {
t.not(publicUser, null);
t.is(publicUser!.id, user.id);
t.true(!('password' in publicUser!));
t.true(!('email' in publicUser!));
});
test('should get workspace user by id', async t => {
const user = await t.context.user.create({
email: 'test@affine.pro',
});
const workspaceUser = await t.context.user.getWorkspaceUser(user.id);
t.not(workspaceUser, null);
t.is(workspaceUser!.id, user.id);
t.true(!('password' in workspaceUser!));
t.is(workspaceUser!.email, user.email);
});
test('should get workspace user by email', async t => {
const user = await t.context.user.create({
email: 'test@affine.pro',
});
const workspaceUser = await t.context.user.getWorkspaceUserByEmail(
user.email
);
t.not(workspaceUser, null);
t.is(workspaceUser!.id, user.id);
t.true(!('password' in workspaceUser!));
t.is(workspaceUser!.email, user.email);
});
test('should get user by email', async t => {