Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 족보에 가게 추가 삭제 API 구현 #65

Merged
merged 10 commits into from
Jul 15, 2024
Merged

Conversation

PicturePark1101
Copy link
Contributor

@PicturePark1101 PicturePark1101 commented Jul 12, 2024

Related Issue 📌

close #39

Description ✔️

  • 족보에 가게 추가 삭제 API 구현

To Reviewers

추가의 경우 쿼리가 6방, 삭제의 경우 5방 나갑니다..

생성

  1. favorite 찾는 쿼리
  2. store 찾는 쿼리
  3. 이미 존재하는지 검사하는 쿼리
  4. favoritestore 삽입하는 쿼리
  5. favorite에 존재하는 favoritestore 개수 세는 쿼리
Hibernate: 
    select
        f1_0.favorite_id,
        f1_0.created_at,
        f1_0.detail,
        f1_0.image_url,
        f1_0.name,
        f1_0.updated_at,
        u1_0.user_id,
        u1_0.created_at,
        u1_0.deleted_at,
        u1_0.email,
        u1_0.member_status,
        u1_0.name,
        u1_0.platform,
        u1_0.serial_id,
        u1_0.updated_at,
        u1_0.user_role 
    from
        favorite f1_0 
    join
        users u1_0 
            on u1_0.user_id=f1_0.user_id 
    where
        f1_0.favorite_id=?
Hibernate: 
    select
        s1_0.store_id,
        s1_0.category,
        s1_0.created_at,
        s1_0.heart_count,
        s1_0.is_deleted,
        s1_0.lowest_price,
        s1_0.name,
        s1_0.latitude,
        s1_0.longitude,
        s1_0.updated_at 
    from
        store s1_0 
    where
        s1_0.store_id=? 
        and s1_0.is_deleted=false
Hibernate: 
    select
        exists(select
            fs1_0.favorite_store_id 
        from
            favorite_store fs1_0 
        where
            fs1_0.favorite_id=? 
            and fs1_0.store_id=?)
Hibernate: 
    insert 
    into
        favorite_store
        (favorite_id, store_id) 
    values
        (?, ?) 
    returning favorite_store_id
Hibernate: 
    select
        count(fs1_0.favorite_store_id) 
    from
        favorite_store fs1_0 
    where
        fs1_0.favorite_id=?
Hibernate: 
    update
        favorite 
    set
        detail=?,
        image_type=?,
        name=?,
        updated_at=?,
        user_id=? 
    where
        favorite_id=?

삭제 쿼리

생성

  1. favorite 찾는 쿼리
  2. favoritestore 찾는 쿼리
  3. 삭제하는 쿼리
  4. favorite에 존재하는 favoritestore 개수 세는 쿼리
Hibernate: 
    select
        f1_0.favorite_id,
        f1_0.created_at,
        f1_0.detail,
        f1_0.image_url,
        f1_0.name,
        f1_0.updated_at,
        u1_0.user_id,
        u1_0.created_at,
        u1_0.deleted_at,
        u1_0.email,
        u1_0.member_status,
        u1_0.name,
        u1_0.platform,
        u1_0.serial_id,
        u1_0.updated_at,
        u1_0.user_role 
    from
        favorite f1_0 
    join
        users u1_0 
            on u1_0.user_id=f1_0.user_id 
    where
        f1_0.favorite_id=?
Hibernate: 
    select
        fs1_0.favorite_store_id,
        fs1_0.favorite_id,
        fs1_0.store_id 
    from
        favorite_store fs1_0 
    where
        fs1_0.favorite_id=? 
        and fs1_0.store_id=?
Hibernate: 
    delete 
    from
        favorite_store 
    where
        favorite_store_id=?
Hibernate: 
    select
        count(fs1_0.favorite_store_id) 
    from
        favorite_store fs1_0 
    where
        fs1_0.favorite_id=?
Hibernate: 
    update
        favorite 
    set
        detail=?,
        image_type=?,
        name=?,
        updated_at=?,
        user_id=? 
    where
        favorite_id=?

@PicturePark1101 PicturePark1101 merged commit b8a706f into develop Jul 15, 2024
1 check passed
@PicturePark1101 PicturePark1101 deleted the feat/39 branch July 15, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 족보에서 특정 식당 삭제 추가 API 구현
2 participants