From e15a8fff7f5f3212656ac57d7713cfc9b8ddf638 Mon Sep 17 00:00:00 2001 From: orlein Date: Thu, 28 Nov 2024 13:15:26 +0900 Subject: [PATCH] update tags for account, challenge, post --- package.json | 2 +- src/account/account-api-live.mts | 9 ++-- src/account/account-api.mts | 29 +++++++++++-- src/account/account-repo.mts | 23 ++++++++-- src/account/account-service.mts | 6 +++ src/api.mts | 4 +- src/challenge/challenge-api-live.mts | 3 ++ src/challenge/challenge-api.mts | 20 +++++++++ src/challenge/challenge-repo.mts | 17 ++++++++ src/challenge/challenge-service.mts | 6 +++ src/post/post-api-live.mts | 1 + src/post/post-api.mts | 20 +++++++++ src/post/post-repo.mts | 14 ++++++ src/post/post-service.mts | 15 ++++--- src/tag/tag-api-live.mts | 19 --------- src/tag/tag-api.mts | 64 ---------------------------- src/tag/tag-repo.mts | 34 +++------------ src/tag/tag-service.mts | 8 +--- 18 files changed, 159 insertions(+), 135 deletions(-) diff --git a/package.json b/package.json index b6989d9..4f0642b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oz-adv/backend", - "version": "0.0.2 (2024-11-28.001)", + "version": "0.0.2 (2024-11-28.002)", "description": "Backend for the Oz-Adv project", "type": "module", "scripts": { diff --git a/src/account/account-api-live.mts b/src/account/account-api-live.mts index e12fdd8..498066d 100644 --- a/src/account/account-api-live.mts +++ b/src/account/account-api-live.mts @@ -16,11 +16,14 @@ export const AccountApiLive = HttpApiBuilder.group(Api, 'account', (handlers) => .handle('signUp', ({ payload }) => accountService.signUp(payload).pipe(withSystemActor), ) - .handle('findById', ({ path }) => accountService.findAccountById(path.id)) + .handle('findById', ({ path }) => + accountService.findAccountById(path.accountId), + ) + .handle('findTags', ({ path }) => accountService.findTags(path.accountId)) .handle('updateById', ({ path, payload }) => accountService - .updateAccountById(path.id, payload) - .pipe(policyUse(accountPolicy.canUpdate(path.id))), + .updateAccountById(path.accountId, payload) + .pipe(policyUse(accountPolicy.canUpdate(path.accountId))), ) .handle('signIn', ({ payload }) => accountService.signIn(payload).pipe(withSystemActor), diff --git a/src/account/account-api.mts b/src/account/account-api.mts index b6aec87..c6ccce1 100644 --- a/src/account/account-api.mts +++ b/src/account/account-api.mts @@ -16,13 +16,14 @@ import { import { Account, AccountId } from './account-schema.mjs'; import { SignIn } from './sign-in-schema.mjs'; import { SignUp } from './sign-up-schema.mjs'; +import { Tag } from '@/tag/tag-schema.mjs'; export class AccountApi extends HttpApiGroup.make('account') .add( - HttpApiEndpoint.get('findById', '/:id') + HttpApiEndpoint.get('findById', '/:accountId') .setPath( Schema.Struct({ - id: AccountId, + accountId: AccountId, }), ) .addSuccess(Account.json) @@ -39,10 +40,30 @@ export class AccountApi extends HttpApiGroup.make('account') ), ) .add( - HttpApiEndpoint.patch('updateById', '/:id') + HttpApiEndpoint.get('findTags', '/:accountId/tags') .setPath( Schema.Struct({ - id: AccountId, + accountId: AccountId, + }), + ) + .addError(AccountNotFound) + .addSuccess(Schema.Array(Tag.json)) + .annotateContext( + OpenApi.annotations({ + title: '계정 태그 조회', + description: + '계정의 태그를 조회합니다. 계정이 존재하지 않는 경우 404를 반환합니다. 다른 사람의 계정을 조회할 수 있습니다. 로그인하지 않아도 사용할 수 있습니다.', + override: { + summary: '(사용가능) 계정 태그 조회', + }, + }), + ), + ) + .add( + HttpApiEndpoint.patch('updateById', '/:accountId') + .setPath( + Schema.Struct({ + accountId: AccountId, }), ) .middleware(Authentication) diff --git a/src/account/account-repo.mts b/src/account/account-repo.mts index c1e6676..8929607 100644 --- a/src/account/account-repo.mts +++ b/src/account/account-repo.mts @@ -1,10 +1,11 @@ +import { Email } from '@/misc/email-schema.mjs'; +import { makeTestLayer } from '@/misc/test-layer.mjs'; import { SqlLive } from '@/sql/sql-live.mjs'; +import { Tag } from '@/tag/tag-schema.mjs'; import { Model, SqlClient, SqlSchema } from '@effect/sql'; import { Context, Effect, Layer, Option, pipe } from 'effect'; -import { Account, AccountId } from './account-schema.mjs'; -import { makeTestLayer } from '@/misc/test-layer.mjs'; -import { Email } from '@/misc/email-schema.mjs'; import { AccountNotFound } from './account-error.mjs'; +import { Account, AccountId } from './account-schema.mjs'; const make = Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; @@ -21,6 +22,21 @@ const make = Effect.gen(function* () { execute: (key) => sql`select * from account where email = ${key}`, })(email).pipe(Effect.orDie, Effect.withSpan('AccountRepo.findByEmail')); + const findTags = (accountId: AccountId) => + SqlSchema.findAll({ + Request: AccountId, + Result: Tag, + execute: (req) => sql` +SELECT DISTINCT t.* +FROM tag t +left join tag_target tt on tt.tag_id = t.id +left join challenge_participant cp on tt.challenge_id = cp.challenge_id +LEFT JOIN post p ON tt.post_id = p.id +LEFT JOIN challenge c ON tt.challenge_id = c.id +WHERE p.account_id = ${req} + OR c.account_id = ${req};`, + })(accountId).pipe(Effect.orDie, Effect.withSpan('AccountRepo.findTags')); + const updateById = ( existing: Account, target: Partial, @@ -52,6 +68,7 @@ const make = Effect.gen(function* () { return { ...repo, findByEmail, + findTags, updateById, with: with_, } as const; diff --git a/src/account/account-service.mts b/src/account/account-service.mts index 80ff88a..bfbb8ef 100644 --- a/src/account/account-service.mts +++ b/src/account/account-service.mts @@ -154,6 +154,11 @@ const make = Effect.gen(function* () { }), ); + const findTags = (accountId: AccountId) => + accountRepo + .findTags(accountId) + .pipe(Effect.withSpan('AccountService.findTags')); + const embellishAccount = (target: Account) => Effect.gen(function* () { const maybeAccount = yield* accountRepo.findById(target.id); @@ -215,6 +220,7 @@ const make = Effect.gen(function* () { signUp, signIn, findByIdFromRepo, + findTags, findAccountByEmail, findAccountById, updateAccountById, diff --git a/src/api.mts b/src/api.mts index 74df767..3b8a922 100644 --- a/src/api.mts +++ b/src/api.mts @@ -36,12 +36,14 @@ export class Api extends HttpApi.empty OpenApi.annotations({ title: '오즈 6기 심화반 챌린지 서비스를 위한 백엔드', description: `최신변경점: +* 챌린지 태그조회 api 위치변경: tag -> challenge (2024-11-28.002) +* 게시글 태그조회 api 위치변경: tag -> post (2024-11-28.002) +* 특정 유저의 태그조회 api 위치변경: tag -> account (2024-11-28.002) * 챌린지 / 게시글 isDeleted 반영 (2024-11-28.001) * 태그 db에 색을 받을 수있게 함 (2024-11-27.002) * [유저가 참여한 챌린지]와 [유저가 쓴 글], [유저가 만든 챌린지]의 태그를 찾아, 그를 프로필에 표시할 수 있게 지원하는 기능 (2024-11-27.001) 예정변경점: -* 챌린지 / 게시글의 태그를 가져올 수 있는 기능 * 챌린지 / 게시글의 태그를 삭제하는 기능 * 내가 만든 챌린지 목록을 가져오는 기능 * 내가 참여중인 챌린지 목록을 가져오는 기능 diff --git a/src/challenge/challenge-api-live.mts b/src/challenge/challenge-api-live.mts index 3b192b8..7e91967 100644 --- a/src/challenge/challenge-api-live.mts +++ b/src/challenge/challenge-api-live.mts @@ -23,6 +23,9 @@ export const ChallengeApiLive = HttpApiBuilder.group( .handle('findById', ({ path }) => challengeService.findByIdWithView(path.challengeId), ) + .handle('findTags', ({ path }) => + challengeService.findTags(path.challengeId), + ) .handle('create', ({ payload }) => challengeService .create(payload) diff --git a/src/challenge/challenge-api.mts b/src/challenge/challenge-api.mts index 71c51ca..48757b5 100644 --- a/src/challenge/challenge-api.mts +++ b/src/challenge/challenge-api.mts @@ -15,6 +15,7 @@ import { } from './challenge-participant-error.mjs'; import { Account } from '@/account/account-schema.mjs'; import { EmptySchema } from '@/misc/empty-schema.mjs'; +import { Tag } from '@/tag/tag-schema.mjs'; export class ChallengeApi extends HttpApiGroup.make('challenge') .add( @@ -50,6 +51,25 @@ export class ChallengeApi extends HttpApiGroup.make('challenge') }), ), ) + .add( + HttpApiEndpoint.get('findTags', '/:challengeId/tags') + .setPath( + Schema.Struct({ + challengeId: ChallengeId, + }), + ) + .addError(ChallengeNotFound) + .addSuccess(Schema.Array(Tag.json)) + .annotateContext( + OpenApi.annotations({ + description: + '(사용가능) 챌린지의 태그 목록을 조회합니다. 챌린지가 존재하지 않는 경우 404를 반환합니다.', + override: { + summary: '(사용가능) 챌린지 태그 목록 조회', + }, + }), + ), + ) .add( HttpApiEndpoint.post('create', '/') .middleware(Authentication) diff --git a/src/challenge/challenge-repo.mts b/src/challenge/challenge-repo.mts index 52f1ac9..e3d0a2b 100644 --- a/src/challenge/challenge-repo.mts +++ b/src/challenge/challenge-repo.mts @@ -7,6 +7,7 @@ import { Model, SqlClient, SqlSchema } from '@effect/sql'; import { Effect, Layer, Option, pipe, Schema } from 'effect'; import { ChallengeNotFound } from './challenge-error.mjs'; import { Challenge, ChallengeId, ChallengeView } from './challenge-schema.mjs'; +import { Tag } from '@/tag/tag-schema.mjs'; const snakeCase = (str: string) => str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`); @@ -28,6 +29,21 @@ const make = Effect.gen(function* () { idColumn: 'id', }); + const findTags = (challengeId: ChallengeId) => + SqlSchema.findAll({ + Request: ChallengeId, + Result: Tag, + execute: (req) => sql` +SELECT DISTINCT t.* +FROM tag t +left join tag_target tt on tt.tag_id = t.id +LEFT JOIN challenge c ON tt.challenge_id = c.id +WHERE c.id = ${req};`, + })(challengeId).pipe( + Effect.orDie, + Effect.withSpan('ChallengeRepo.findTags'), + ); + const findAllWithView = (params: FindManyUrlParams) => Effect.gen(function* () { const challenges = yield* SqlSchema.findAll({ @@ -115,6 +131,7 @@ offset ${(params.page - 1) * params.limit}`, insert, viewRepo, findAllWithView, + findTags, with: with_, withView: withView_, } as const; diff --git a/src/challenge/challenge-service.mts b/src/challenge/challenge-service.mts index 040973f..a310b37 100644 --- a/src/challenge/challenge-service.mts +++ b/src/challenge/challenge-service.mts @@ -21,6 +21,11 @@ const make = Effect.gen(function* () { .findAllWithView(params) .pipe(Effect.withSpan('ChallengeService.findChallenges')); + const findTags = (challengeId: ChallengeId) => + challengeRepo + .findTags(challengeId) + .pipe(Effect.withSpan('ChallengeService.findTags')); + const create = (challenge: typeof Challenge.jsonCreate.Type) => pipe( CurrentAccount, @@ -110,6 +115,7 @@ const make = Effect.gen(function* () { findByIdWithView, findByIdFromRepo, findChallenges, + findTags, findLikeStatus, addLikeChallengeById, removeLikeChallengeById, diff --git a/src/post/post-api-live.mts b/src/post/post-api-live.mts index ca93655..6ce4926 100644 --- a/src/post/post-api-live.mts +++ b/src/post/post-api-live.mts @@ -16,6 +16,7 @@ export const PostApiLive = HttpApiBuilder.group(Api, 'post', (handlers) => .handle('findById', ({ path }) => postService.increaseViewCountById(path.postId), ) + .handle('findTags', ({ path }) => postService.findTags(path.postId)) .handle('create', ({ payload }) => postService.create(payload).pipe(withSystemActor), ) diff --git a/src/post/post-api.mts b/src/post/post-api.mts index 6f14f43..48fb9c8 100644 --- a/src/post/post-api.mts +++ b/src/post/post-api.mts @@ -9,6 +9,7 @@ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from '@effect/platform'; import { Schema } from 'effect'; import { PostNotFound } from './post-error.mjs'; import { Post, PostId, PostView } from './post-schema.mjs'; +import { Tag } from '@/tag/tag-schema.mjs'; export class PostApi extends HttpApiGroup.make('post') .add( @@ -44,6 +45,25 @@ export class PostApi extends HttpApiGroup.make('post') }), ), ) + .add( + HttpApiEndpoint.get('findTags', '/:postId/tags') + .setPath( + Schema.Struct({ + postId: PostId, + }), + ) + .addError(PostNotFound) + .addSuccess(Schema.Array(Tag.json)) + .annotateContext( + OpenApi.annotations({ + description: + '게시글의 태그 목록을 조회합니다. 게시글이 존재하지 않는 경우 404를 반환합니다.', + override: { + summary: '(사용가능) 게시글 태그 목록 조회', + }, + }), + ), + ) .add( HttpApiEndpoint.get('findLikeStatus', '/:postId/like-status') .middleware(Authentication) diff --git a/src/post/post-repo.mts b/src/post/post-repo.mts index 8cb958f..1fc9d56 100644 --- a/src/post/post-repo.mts +++ b/src/post/post-repo.mts @@ -8,6 +8,7 @@ import { Model, SqlClient, SqlSchema } from '@effect/sql'; import { Effect, Layer, Option, pipe } from 'effect'; import { PostNotFound } from './post-error.mjs'; import { Post, PostId, PostView } from './post-schema.mjs'; +import { Tag } from '@/tag/tag-schema.mjs'; const TABLE_NAME = 'post'; const VIEW_NAME = 'post_like_counts'; @@ -26,6 +27,18 @@ const make = Effect.gen(function* () { idColumn: 'id', }); + const findTags = (postId: PostId) => + SqlSchema.findAll({ + Request: PostId, + Result: Tag, + execute: (req) => sql` +SELECT DISTINCT t.* +FROM tag t +left join tag_target tt on tt.tag_id = t.id +LEFT JOIN post p ON tt.post_id = p.id +WHERE p.id = ${req};`, + })(postId).pipe(Effect.orDie, Effect.withSpan('PostRepo.findTags')); + const findAllWithView = (params: FindManyUrlParams) => Effect.gen(function* () { const posts = yield* SqlSchema.findAll({ @@ -96,6 +109,7 @@ const make = Effect.gen(function* () { ...repo, viewRepo, findAllWithView, + findTags, with: with_, withView: withView_, } as const; diff --git a/src/post/post-service.mts b/src/post/post-service.mts index 1ceb7af..71201de 100644 --- a/src/post/post-service.mts +++ b/src/post/post-service.mts @@ -11,18 +11,20 @@ const make = Effect.gen(function* () { const postRepo = yield* PostRepo; const likeService = yield* LikeService; - const findByIdFromRepo = (id: PostId) => postRepo.findById(id); + const findByIdFromRepo = (postId: PostId) => postRepo.findById(postId); const findPosts = (params: FindManyUrlParams) => postRepo .findAllWithView(params) .pipe(Effect.withSpan('PostService.findPosts')); - const findByIdWithView = (id: PostId) => - postRepo.withView(id, (post) => + const findByIdWithView = (postId: PostId) => + postRepo.withView(postId, (post) => pipe(Effect.succeed(post), Effect.withSpan('PostService.findById')), ); + const findTags = (postId: PostId) => postRepo.findTags(postId); + const create = (post: typeof Post.jsonCreate.Type) => pipe( CurrentAccount, @@ -56,10 +58,10 @@ const make = Effect.gen(function* () { ), ); - const deleteById = (id: PostId) => - postRepo.with(id, (post) => + const deleteById = (postId: PostId) => + postRepo.with(postId, (post) => pipe( - postRepo.delete(id), + postRepo.delete(postId), Effect.withSpan('PostService.deleteById'), policyRequire('post', 'delete'), ), @@ -130,6 +132,7 @@ const make = Effect.gen(function* () { findPosts, findByIdWithView, findLikeStatus, + findTags, increaseViewCountById, addLikePostById, removePostLikeById, diff --git a/src/tag/tag-api-live.mts b/src/tag/tag-api-live.mts index bf816ff..629f4f8 100644 --- a/src/tag/tag-api-live.mts +++ b/src/tag/tag-api-live.mts @@ -12,28 +12,9 @@ export const TagApiLive = HttpApiBuilder.group(Api, 'tag', (handlers) => const tagPolicy = yield* TagPolicy; return handlers - .handle('accountTags', ({ path }) => - tagService.findByAccountId(path.accountId), - ) .handle('findAll', ({ urlParams }) => tagService.findAll(urlParams)) .handle('findById', ({ path }) => tagService.findById(path.tagId)) .handle('findByName', ({ path }) => tagService.findByName(path.tagName)) - .handle('connectPostByNames', ({ payload }) => - tagService - .connectPostByNames({ - postId: payload.postId, - names: payload.names, - }) - .pipe(policyUse(tagPolicy.canCreate())), - ) - .handle('connectChallengeByNames', ({ payload }) => - tagService - .connectChallengeByNames({ - challengeId: payload.challengeId, - names: payload.names, - }) - .pipe(policyUse(tagPolicy.canConnectChallenge(payload.challengeId))), - ) .handle('create', ({ payload }) => tagService.getOrInsert(payload).pipe(policyUse(tagPolicy.canCreate())), ) diff --git a/src/tag/tag-api.mts b/src/tag/tag-api.mts index e124f45..5daa6c3 100644 --- a/src/tag/tag-api.mts +++ b/src/tag/tag-api.mts @@ -1,35 +1,13 @@ import { Authentication } from '@/auth/authentication.mjs'; import { Unauthorized } from '@/auth/error-403.mjs'; -import { ChallengeId } from '@/challenge/challenge-schema.mjs'; import { FindManyResultSchema } from '@/misc/find-many-result-schema.mjs'; import { FindManyUrlParams } from '@/misc/find-many-url-params-schema.mjs'; -import { PostId } from '@/post/post-schema.mjs'; import { HttpApiEndpoint, HttpApiGroup, OpenApi } from '@effect/platform'; import { Schema } from 'effect'; import { TagNotFound } from './tag-error.mjs'; import { Tag, TagId } from './tag-schema.mjs'; -import { AccountId } from '@/account/account-schema.mjs'; -import { ChallengeNotFound } from '@/challenge/challenge-error.mjs'; -import { PostNotFound } from '@/post/post-error.mjs'; export class TagApi extends HttpApiGroup.make('tag') - .add( - HttpApiEndpoint.get('accountTags', '/account-tags/:accountId') - .setPath( - Schema.Struct({ - accountId: AccountId, - }), - ) - .addSuccess(Schema.Array(Tag.json)) - .annotateContext( - OpenApi.annotations({ - description: '사용자의 태그 목록을 조회합니다.', - override: { - summary: '(사용가능) 사용자의 태그 목록 조회', - }, - }), - ), - ) .add( HttpApiEndpoint.get('findAll', '/') .setUrlParams(FindManyUrlParams) @@ -97,48 +75,6 @@ export class TagApi extends HttpApiGroup.make('tag') }), ), ) - .add( - HttpApiEndpoint.post('connectPostByNames', '/connect-post') - .middleware(Authentication) - .setPayload( - Schema.Struct({ - postId: PostId, - names: Schema.Array(Schema.String), - }), - ) - .addError(Unauthorized) - .addError(PostNotFound) - .addSuccess(Schema.Array(Tag.json)) - .annotateContext( - OpenApi.annotations({ - description: '태그를 생성하거나 post에 연결합니다.', - override: { - summary: '(사용가능) 태그 post 연결', - }, - }), - ), - ) - .add( - HttpApiEndpoint.post('connectChallengeByNames', '/connect-challenge') - .middleware(Authentication) - .setPayload( - Schema.Struct({ - challengeId: ChallengeId, - names: Schema.Array(Schema.String), - }), - ) - .addError(Unauthorized) - .addError(ChallengeNotFound) - .addSuccess(Schema.Array(Tag.json)) - .annotateContext( - OpenApi.annotations({ - description: '태그를 생성하거나 challenge에 연결합니다.', - override: { - summary: '(사용가능) 태그 challenge 연결', - }, - }), - ), - ) .add( HttpApiEndpoint.patch('update', '/:tagId') .middleware(Authentication) diff --git a/src/tag/tag-repo.mts b/src/tag/tag-repo.mts index c25d73c..f4ade99 100644 --- a/src/tag/tag-repo.mts +++ b/src/tag/tag-repo.mts @@ -1,15 +1,14 @@ +import { ChallengeId } from '@/challenge/challenge-schema.mjs'; +import { CommonCountSchema } from '@/misc/common-count-schema.mjs'; +import { FindManyResultSchema } from '@/misc/find-many-result-schema.mjs'; +import { FindManyUrlParams } from '@/misc/find-many-url-params-schema.mjs'; +import { PostId } from '@/post/post-schema.mjs'; +import { SqlLive } from '@/sql/sql-live.mjs'; import { Model, SqlClient, SqlSchema } from '@effect/sql'; import { Effect, Layer, Option, pipe, Schema } from 'effect'; -import { Tag, TagId } from './tag-schema.mjs'; import { TagNotFound } from './tag-error.mjs'; -import { SqlLive } from '@/sql/sql-live.mjs'; -import { FindManyUrlParams } from '@/misc/find-many-url-params-schema.mjs'; +import { Tag, TagId } from './tag-schema.mjs'; import { TagTarget } from './tag-target-schema.mjs'; -import { PostId } from '@/post/post-schema.mjs'; -import { ChallengeId } from '@/challenge/challenge-schema.mjs'; -import { FindManyResultSchema } from '@/misc/find-many-result-schema.mjs'; -import { CommonCountSchema } from '@/misc/common-count-schema.mjs'; -import { AccountId } from '@/account/account-schema.mjs'; const TABLE_NAME = 'tag'; @@ -48,24 +47,6 @@ const make = Effect.gen(function* () { }); }).pipe(Effect.orDie, Effect.withSpan('TagRepo.findAll')); - const findAllByAccountId = (accountId: AccountId) => - SqlSchema.findAll({ - Request: AccountId, - Result: Tag, - execute: (req) => sql` -SELECT DISTINCT t.* -FROM tag t -left join tag_target tt on tt.tag_id = t.id -left join challenge_participant cp on tt.challenge_id = cp.challenge_id -LEFT JOIN post p ON tt.post_id = p.id -LEFT JOIN challenge c ON tt.challenge_id = c.id -WHERE p.account_id = ${req} - OR c.account_id = ${req};`, - })(accountId).pipe( - Effect.orDie, - Effect.withSpan('TagRepo.findByAccountId'), - ); - const findManyByIds = (ids: readonly TagId[]) => SqlSchema.findAll({ Request: Schema.Array(TagId), @@ -250,7 +231,6 @@ SELECT * FROM conflicted_rows; findAll, findManyByIds, findOne, - findAllByAccountId, getManyOrInsertMany, getOrInsert, connectTagsToPost, diff --git a/src/tag/tag-service.mts b/src/tag/tag-service.mts index e0a70f3..26c8d65 100644 --- a/src/tag/tag-service.mts +++ b/src/tag/tag-service.mts @@ -1,4 +1,3 @@ -import { AccountId } from '@/account/account-schema.mjs'; import { policyRequire } from '@/auth/authorization.mjs'; import { ChallengeId } from '@/challenge/challenge-schema.mjs'; import { FindManyUrlParams } from '@/misc/find-many-url-params-schema.mjs'; @@ -14,11 +13,6 @@ const make = Effect.gen(function* () { const findAll = (parmas: FindManyUrlParams) => repo.findAll(parmas).pipe(Effect.withSpan('TagService.findAll')); - const findByAccountId = (accountId: AccountId) => - repo - .findAllByAccountId(accountId) - .pipe(Effect.withSpan('TagService.findByAccountId')); - const findById = (id: TagId) => repo.findById(id).pipe( Effect.flatMap( @@ -94,7 +88,7 @@ const make = Effect.gen(function* () { findAll, findById, findByName, - findByAccountId, + getOrInsert, connectPostByNames, connectChallengeByNames,