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 : 첫 화면인기 마감임박 보여주기 구현 #40

Merged

Conversation

SonMyeongJin
Copy link
Contributor

@SonMyeongJin SonMyeongJin commented Aug 1, 2024

요약 (Summary)

  • 홈화면에 나오는 인기크루 , 마감임박 소셜링 구현했습니다.
  • 인기크루는 crew가 참조하고있는 member_crew가 많은 순으로 상위 4개를 반환합니다.
  • 마감임박 소셜링은 socialring_date가 임박한 상위 4개를 반환합니다.
  • 해더에 auth가 필요합니다.

🔑 변경 사항 (Key Changes)

📝 리뷰 요구사항 (To Reviewers)

  • DB에 샘플 정보들을 입력합니다
USE likelion12;

-- Insert random data into the facility table
INSERT INTO facility (
    created_at, modified_at, weekday, weekend, administer, facility_address, facility_name, facility_phone, facility_size, status
) VALUES
('2024-08-01 08:00:00', '2024-08-01 08:00:00', '2024-08-01 09:00:00', '2024-08-02 09:00:00', 'John Doe', '123 Elm Street, North Town', 'Central Gym', '123-456-7890', 'Large', 'ACTIVE'),
('2024-08-02 09:00:00', '2024-08-02 09:00:00', '2024-08-02 10:00:00', '2024-08-03 10:00:00', 'Jane Smith', '456 Oak Avenue, South City', 'West End Center', '234-567-8901', 'Medium', 'ACTIVE'),
('2024-08-03 10:00:00', '2024-08-03 10:00:00', '2024-08-03 11:00:00', '2024-08-04 11:00:00', 'Emily Johnson', '789 Pine Road, East Village', 'Northside Facility', '345-678-9012', 'Small', 'DELETE');

USE likelion12;

-- Insert random data into the activity_region table
INSERT INTO activity_region (
    created_at, modified_at, activity_region_name, status
) VALUES
('2024-08-01 09:00:00', '2024-08-01 09:00:00', 'North Zone', 'ACTIVE'),
('2024-08-02 10:00:00', '2024-08-02 10:00:00', 'South Region', 'ACTIVE'),
('2024-08-03 11:00:00', '2024-08-03 11:00:00', 'East Area', 'DELETE');

USE likelion12;

-- Insert random data into the exercise table
INSERT INTO exercise (
    created_at, modified_at, exercise_name, status
) VALUES
('2024-08-01 09:00:00', '2024-08-01 09:00:00', 'Strength Training', 'ACTIVE'),
('2024-08-02 10:00:00', '2024-08-02 10:00:00', 'Cardio Workout', 'ACTIVE'),
('2024-08-03 11:00:00', '2024-08-03 11:00:00', 'Yoga Session', 'DELETE');

USE likelion12;

-- Insert random data into the member table
INSERT INTO member (
    created_at, modified_at, exercise_id, email, member_img, member_name, gender, status
) VALUES
('2024-08-01 09:00:00', '2024-08-01 09:00:00', 1, '[email protected]', 'john_doe.jpg', 'John Doe', 'M', 'ACTIVE'),
('2024-08-02 10:00:00', '2024-08-02 10:00:00', 2, '[email protected]', 'jane_smith.jpg', 'Jane Smith', 'F', 'ACTIVE'),
('2024-08-03 11:00:00', '2024-08-03 11:00:00', 3, '[email protected]', 'alex_jones.jpg', 'Alex Jones', 'M', 'DELETE'),
('2024-08-04 12:00:00', '2024-08-04 12:00:00', 1, '[email protected]', 'mary_johnson.jpg', 'Mary Johnson', 'F', 'ACTIVE'),
('2024-08-05 13:00:00', '2024-08-05 13:00:00', 2, '[email protected]', 'michael_brown.jpg', 'Michael Brown', 'M', 'ACTIVE'),
('2024-08-06 14:00:00', '2024-08-06 14:00:00', 3, '[email protected]', 'emily_davis.jpg', 'Emily Davis', 'F', 'DELETE');

USE likelion12;

-- Insert random data into the crew table
INSERT INTO crew (
    crew_cost, total_recruits, activity_region_id, created_at, crew_id, exercise_id, facility_id, modified_at, comment, comment_simple, crew_img, crew_name, gender, level, status
) VALUES
(1500, 50, 1, '2024-08-01 09:00:00', 1, 1, 1, '2024-08-01 09:00:00', 'Experienced crew for initial phase', 'Top performers', 'alpha_team.jpg', 'Alpha Team', 'M', 'A', 'ACTIVE'),
(1200, 40, 2, '2024-08-02 10:00:00', 2, 2, 2, '2024-08-02 10:00:00', 'Skilled crew for mid-level tasks', 'Highly capable', 'bravo_squad.jpg', 'Bravo Squad', 'F', 'S', 'ACTIVE'),
(1800, 60, 3, '2024-08-03 11:00:00', 3, 3, 3, '2024-08-03 11:00:00', 'Veteran crew for high-impact operations', 'Elite force', 'charlie_force.jpg', 'Charlie Force', 'U', 'B', 'ACTIVE'),
(1600, 55, 1, '2024-08-04 12:00:00', 4, 1, 1, '2024-08-04 12:00:00', 'Expert crew for critical missions', 'Star team', 'delta_unit.jpg', 'Delta Unit', 'M', 'C', 'ACTIVE'),
(1400, 45, 2, '2024-08-05 13:00:00', 5, 2, 2, '2024-08-05 13:00:00', 'Qualified crew for standard tasks', 'Prime team', 'echo_team.jpg', 'Echo Team', 'F', 'A', 'DELETE'),
(1100, 35, 3, '2024-08-06 14:00:00', 6, 3, 3, '2024-08-06 14:00:00', 'New recruits for training', 'Entry level', 'foxtrot_group.jpg', 'Foxtrot Group', 'U', 'B', 'ACTIVE');

USE likelion12;

-- Insert random data into the socialring table
INSERT INTO socialring (
    socialring_cost, total_recruits, activity_region_id, created_at, exercise_id, facility_id, modified_at, socialring_date, socialring_id, comment, comment_simple, socialring_img, socialring_name, gender, level, status
) VALUES
(2000, 100, 1, '2024-08-01 08:00:00', 1, 1, '2024-08-01 08:00:00', '2024-08-15 10:00:00', 1, 'Top socialring in the North Region', 'Premier group', 'socialring1.jpg', 'Alpha Socialring', 'M', 'A', 'ACTIVE'),
(1800, 90, 2, '2024-08-02 09:15:00', 2, 2, '2024-08-02 09:15:00', '2024-08-16 11:00:00', 2, 'Highly active socialring in the South Region', 'Leading team', 'socialring2.jpg', 'Bravo Socialring', 'F', 'S', 'ACTIVE'),
(2200, 110, 3, '2024-08-03 10:30:00', 3, 3, '2024-08-03 10:30:00', '2024-08-17 12:00:00', 3, 'Elite socialring in the East Area', 'Top performers', 'socialring3.jpg', 'Charlie Socialring', 'U', 'B', 'ACTIVE'),
(1700, 85, 1, '2024-08-04 11:45:00', 1, 1, '2024-08-04 11:45:00', '2024-08-18 13:00:00', 4, 'Expert socialring for the North Zone', 'Star group', 'socialring4.jpg', 'Delta Socialring', 'M', 'C', 'ACTIVE'),
(1500, 70, 2, '2024-08-05 12:00:00', 2, 2, '2024-08-05 12:00:00', '2024-08-19 14:00:00', 5, 'Qualified socialring in the South Region', 'Prime team', 'socialring5.jpg', 'Echo Socialring', 'F', 'A', 'DELETE'),
(1300, 60, 3, '2024-08-06 13:15:00', 3, 3, '2024-08-06 13:15:00', '2024-08-20 15:00:00', 6, 'New socialring for East Area', 'Entry level', 'socialring6.jpg', 'Foxtrot Socialring', 'U', 'B', 'ACTIVE');

USE likelion12;

-- Insert random data into the member_crew table
INSERT INTO member_crew (
    created_at, crew_id, member_crew_id, member_id, modified_at, role, status
) VALUES
('2024-08-01 08:00:00', 1, 1, 1, '2024-08-01 08:00:00', 'CAPTAIN', 'ACTIVE'),
('2024-08-01 09:15:00', 2, 2, 2, '2024-08-01 09:15:00', 'CREW', 'ACTIVE'),
('2024-08-01 10:30:00', 3, 3, 3, '2024-08-01 10:30:00', 'CAPTAIN', 'ACTIVE'),
('2024-08-02 11:45:00', 1, 4, 4, '2024-08-02 11:45:00', 'CREW', 'DELETE'),
('2024-08-02 12:00:00', 2, 5, 5, '2024-08-02 12:00:00', 'CAPTAIN', 'ACTIVE'),
('2024-08-02 13:15:00', 3, 6, 6, '2024-08-02 13:15:00', 'CREW', 'ACTIVE');

해더에 auth를 포함한 상태로 /main 에 Get 방식으로 요청합니다

{
    "code": 1000,
    "status": 200,
    "message": "요청에 성공하였습니다.",
    "result": {
        "deadline_imminent": [
            {
                "socialring_name": "Alpha Socialring",
                "socialring_img": "socialring1.jpg",
                "socialring_date": "2024-08-15",
                "active_area_id": 1,
                "total_recruits": 100,
                "socialring_cost": 2000,
                "comment_simple": "Premier group"
            },
            {
                "socialring_name": "Bravo Socialring",
                "socialring_img": "socialring2.jpg",
                "socialring_date": "2024-08-16",
                "active_area_id": 2,
                "total_recruits": 90,
                "socialring_cost": 1800,
                "comment_simple": "Leading team"
            },
            {
                "socialring_name": "Charlie Socialring",
                "socialring_img": "socialring3.jpg",
                "socialring_date": "2024-08-17",
                "active_area_id": 3,
                "total_recruits": 110,
                "socialring_cost": 2200,
                "comment_simple": "Top performers"
            },
            {
                "socialring_name": "Delta Socialring",
                "socialring_img": "socialring4.jpg",
                "socialring_date": "2024-08-18",
                "active_area_id": 1,
                "total_recruits": 85,
                "socialring_cost": 1700,
                "comment_simple": "Star group"
            }
        ],
        "hot_crew": [
            {
                "crew_name": "Alpha Team",
                "crew_img": "alpha_team.jpg",
                "active_area_id": 1,
                "total_recruits": 50,
                "crew_cost": 1500,
                "comment_simple": "Top performers"
            },
            {
                "crew_name": "Bravo Squad",
                "crew_img": "bravo_squad.jpg",
                "active_area_id": 2,
                "total_recruits": 40,
                "crew_cost": 1200,
                "comment_simple": "Highly capable"
            },
            {
                "crew_name": "Charlie Force",
                "crew_img": "charlie_force.jpg",
                "active_area_id": 3,
                "total_recruits": 60,
                "crew_cost": 1800,
                "comment_simple": "Elite force"
            },
            {
                "crew_name": "Delta Unit",
                "crew_img": "delta_unit.jpg",
                "active_area_id": 1,
                "total_recruits": 55,
                "crew_cost": 1600,
                "comment_simple": "Star team"
            }
        ]
    }
}

위와 같이 4개씩 출력되면 성공입니다

@SonMyeongJin SonMyeongJin linked an issue Aug 1, 2024 that may be closed by this pull request
Copy link
Member

@jsilver01 jsilver01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postman 응답오는 형태로 명세서 한번만 수정해주시면 될 것 같습니다!!
전부 제대로 반환되는 것 확인했습니다 수고하셨습니다~

@jsilver01 jsilver01 changed the title 10 be 첫 화면인기 마감임박 보여주기 구현 Feat : 첫 화면인기 마감임박 보여주기 구현 Aug 1, 2024
@SonMyeongJin
Copy link
Contributor Author

Socialring_id 추가 , active_area_id -> active_area_name 변경
수정했습니다!

같은 방식으로 테스트시

{
    "code": 1000,
    "status": 200,
    "message": "요청에 성공하였습니다.",
    "result": {
        "deadline_imminent": [
            {
                "socialring_id": 1,
                "socialring_name": "Alpha Socialring",
                "socialring_img": "socialring1.jpg",
                "socialring_date": "2024-08-15",
                "active_area_name": "North Zone",
                "total_recruits": 100,
                "socialring_cost": 2000,
                "comment_simple": "Premier group"
            },
            {
                "socialring_id": 2,
                "socialring_name": "Bravo Socialring",
                "socialring_img": "socialring2.jpg",
                "socialring_date": "2024-08-16",
                "active_area_name": "South Region",
                "total_recruits": 90,
                "socialring_cost": 1800,
                "comment_simple": "Leading team"
            },
            {
                "socialring_id": 3,
                "socialring_name": "Charlie Socialring",
                "socialring_img": "socialring3.jpg",
                "socialring_date": "2024-08-17",
                "active_area_name": "East Area",
                "total_recruits": 110,
                "socialring_cost": 2200,
                "comment_simple": "Top performers"
            },
            {
                "socialring_id": 4,
                "socialring_name": "Delta Socialring",
                "socialring_img": "socialring4.jpg",
                "socialring_date": "2024-08-18",
                "active_area_name": "North Zone",
                "total_recruits": 85,
                "socialring_cost": 1700,
                "comment_simple": "Star group"
            }
        ],
        "hot_crew": [
            {
                "crew_id": 1,
                "crew_name": "Alpha Team",
                "crew_img": "alpha_team.jpg",
                "active_area_name": "North Zone",
                "total_recruits": 50,
                "crew_cost": 1500,
                "comment_simple": "Top performers"
            },
            {
                "crew_id": 2,
                "crew_name": "Bravo Squad",
                "crew_img": "bravo_squad.jpg",
                "active_area_name": "South Region",
                "total_recruits": 40,
                "crew_cost": 1200,
                "comment_simple": "Highly capable"
            },
            {
                "crew_id": 3,
                "crew_name": "Charlie Force",
                "crew_img": "charlie_force.jpg",
                "active_area_name": "East Area",
                "total_recruits": 60,
                "crew_cost": 1800,
                "comment_simple": "Elite force"
            },
            {
                "crew_id": 4,
                "crew_name": "Delta Unit",
                "crew_img": "delta_unit.jpg",
                "active_area_name": "North Zone",
                "total_recruits": 55,
                "crew_cost": 1600,
                "comment_simple": "Star team"
            }
        ]
    }
}

와 같이 출력되면 정상입니다!

Copy link
Member

@jsilver01 jsilver01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정상 작동 확인하였습니다!! 너무 수고하셨습니다~ 머지하겠습니다!

@jsilver01 jsilver01 merged commit cd8d06d into develop Aug 1, 2024
@jsilver01 jsilver01 deleted the 10-be-첫-화면인기-마감임박-보여주기-구현 branch August 1, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BE] 첫 화면(인기, 마감임박 보여주기) 구현
2 participants