feat: add group recipe sharing and translation

This commit is contained in:
2026-08-14 16:46:01 +09:00
parent 146e78cddf
commit 4491c91455
13 changed files with 170 additions and 19 deletions
+23 -1
View File
@@ -4,7 +4,12 @@ export class FakeRecipeRepository {
}
async listByOwner(ownerGoogleSub) {
return [...this.recipes.values()].filter((recipe) => recipe.ownerGoogleSub === ownerGoogleSub);
return this.listByOwners([ownerGoogleSub]);
}
async listByOwners(ownerGoogleSubs) {
return [...this.recipes.values()]
.filter((recipe) => ownerGoogleSubs.includes(recipe.ownerGoogleSub));
}
async findById(ownerGoogleSub, recipeId) {
@@ -12,6 +17,11 @@ export class FakeRecipeRepository {
return recipe?.ownerGoogleSub === ownerGoogleSub ? recipe : null;
}
async findByIdForOwners(ownerGoogleSubs, recipeId) {
const recipe = this.recipes.get(recipeId);
return ownerGoogleSubs.includes(recipe?.ownerGoogleSub) ? recipe : null;
}
async findBySource(ownerGoogleSub, platform, sourceId) {
return [...this.recipes.values()].find((recipe) => (
recipe.ownerGoogleSub === ownerGoogleSub
@@ -50,6 +60,18 @@ export class FakeRecipeRepository {
}
}
export class FakeGroupRepository {
constructor(groups = []) {
this.groups = groups;
}
async listMemberGoogleSubs(googleSub) {
return [...new Set(this.groups
.filter((group) => group.memberGoogleSubs.includes(googleSub))
.flatMap((group) => group.memberGoogleSubs))];
}
}
export class FakeAllowedEmailRepository {
constructor(accounts = [
{ email: 'google-user-1@example.com', canManageAccess: true },