feat: add group recipe sharing and translation
This commit is contained in:
+23
-1
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user