diff --git a/locker_server/api_orm/fixtures/mission.json b/locker_server/api_orm/fixtures/mission.json index 0e0794c..45e4f17 100644 --- a/locker_server/api_orm/fixtures/mission.json +++ b/locker_server/api_orm/fixtures/mission.json @@ -1,6 +1,6 @@ [ { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "referral", "title": "Referral", @@ -16,7 +16,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "extension_installation_and_review", "title": "Extension Installation & Review", @@ -32,7 +32,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "desktop_app_installation", "title": "Desktop App Installation", @@ -48,7 +48,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "app_store_rating_and_review", "title": "App Store Rating & Review", @@ -64,7 +64,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "google_play_rating_and_review", "title": "Google Play Rating & Review", @@ -80,7 +80,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "capterra_rating_and_review", "title": "Capterra Rating & Review", @@ -96,7 +96,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "trustpilot_rating_and_review", "title": "Trustpilot Rating & Review", @@ -112,7 +112,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "g2_rating_and_review", "title": "G2 Rating & Review", @@ -128,7 +128,7 @@ } }, { - "model": "api_orm.Mission", + "model": "api_orm.MissionORM", "fields": { "id": "reddit_community_participation_and_review", "title": "Reddit Community Participation & Review", @@ -142,5 +142,21 @@ "reward_type": "promo_code", "reward_value": 5 } + }, + { + "model": "api_orm.MissionORM", + "fields": { + "id": "clutch_rating_and_review", + "title": "Clutch Rating & Review", + "description_en": "Review Locker on Clutch", + "description_vi": "Đánh giá Locker trên Clutch", + "created_time": 1714623790, + "mission_type": "review", + "order_index": 10, + "extra_requirements": null, + "available": false, + "reward_type": "promo_code", + "reward_value": 5 + } } ] \ No newline at end of file diff --git a/locker_server/shared/external_services/user_reward_mission/missions/clutch_rating_and_review_mission.py b/locker_server/shared/external_services/user_reward_mission/missions/clutch_rating_and_review_mission.py new file mode 100644 index 0000000..e060ed1 --- /dev/null +++ b/locker_server/shared/external_services/user_reward_mission/missions/clutch_rating_and_review_mission.py @@ -0,0 +1,27 @@ +import requests +from typing import Dict +from bs4 import BeautifulSoup + +from locker_server.shared.constants.missions import REWARD_TYPE_PROMO_CODE +from locker_server.shared.external_services.user_reward_mission.mission import Mission + + +class ClutchRatingAndReviewMission(Mission): + def __init__(self, mission_type: str, extra_requirements=None): + super().__init__(mission_type=mission_type, extra_requirements=extra_requirements) + self.reward_type = REWARD_TYPE_PROMO_CODE + self.reward_value = 5 + + def check_mission_completion(self, input_data: Dict): + return False + url = f"https://clutch.co/profile/locker-password-manager?sort_by=date_desc#reviews" + headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.58", + } + res = requests.get(url=url, headers=headers) + if res.status_code != 200: + return False + content = res.text + soup = BeautifulSoup(content, features="html.parser") +