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

onboarding flow #1411

Merged
merged 103 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
b1306ac
[OPTIM] Leaderboard patches
MZaFaRM Oct 17, 2023
32be3f8
Merge remote-tracking branch 'upstream/dev' into dev
MZaFaRM Oct 17, 2023
fe647c5
[PATCH] User EDIT dashboard
MZaFaRM Oct 17, 2023
1e8cb3e
Merge remote-tracking branch 'upstream/dev' into dev
MZaFaRM Oct 17, 2023
4c61074
Merge branch 'dev-server' of https://github.com/gtech-mulearn/mulearn…
MZaFaRM Oct 17, 2023
df728ac
fix(Organization edit api): issue in affiliation and district id update
anirudh-mk Oct 18, 2023
63e6fd9
Merge pull request #1367 from anirudh-mk/dev
Oct 18, 2023
51aee2e
Merge pull request #1368 from gtech-mulearn/dev
Oct 18, 2023
809c9a5
feat:(KKEM Views, User Views):response changed and logger added
anirudh-mk Oct 18, 2023
899bb94
Merge pull request #1369 from anirudh-mk/dev
Oct 18, 2023
6750551
Merge pull request #1370 from gtech-mulearn/dev
Oct 18, 2023
192bd3e
Merge remote-tracking branch 'upstream/dev' into dev
MZaFaRM Oct 19, 2023
cc32a5a
top 100 coders query
adnankattekaden Oct 19, 2023
7e9e15d
Merge pull request #1371 from adnankattekaden/dev
adnankattekaden Oct 19, 2023
88a2d26
Merge pull request #1372 from gtech-mulearn/dev
adnankattekaden Oct 19, 2023
2ca4cba
top 100 coders query
adnankattekaden Oct 19, 2023
2f023e9
Merge pull request #1373 from adnankattekaden/dev
adnankattekaden Oct 19, 2023
3ae9e6d
Merge pull request #1374 from gtech-mulearn/dev
adnankattekaden Oct 19, 2023
50a173f
top 100 coders query
adnankattekaden Oct 19, 2023
e5c21fe
Merge pull request #1375 from adnankattekaden/dev
adnankattekaden Oct 19, 2023
b2bbfd8
Merge pull request #1376 from gtech-mulearn/dev
adnankattekaden Oct 19, 2023
584ab30
[FEAT] Set up error log and customresponse
MZaFaRM Oct 19, 2023
77aeb5c
[MAJOR] Created a system to handle all unhandled exceptions
MZaFaRM Oct 19, 2023
24ba118
Merge pull request #1377 from MZaFaRM:dev
MZaFaRM Oct 19, 2023
c2a5aef
Merge pull request #1378 from gtech-mulearn:dev
MZaFaRM Oct 19, 2023
e5c184b
fix(OrganizationCreateApi):duplicate uuid
anirudh-mk Oct 19, 2023
33a4473
Merge pull request #1379 from anirudh-mk/dev
adnankattekaden Oct 19, 2023
2c0d9c8
Merge pull request #1380 from gtech-mulearn/dev
adnankattekaden Oct 19, 2023
6c095aa
optim(location api): remove unwanted exceptions
anirudh-mk Oct 19, 2023
76cf00c
optim(organization apis): remove unwanted exceptions
anirudh-mk Oct 19, 2023
9066f5f
optim(profile apis): remove unwanted exceptions
anirudh-mk Oct 19, 2023
f01fce9
optim(roles api): remove unwanted exceptions
anirudh-mk Oct 19, 2023
8266b9f
optim(task apis): remove unwanted exceptions
anirudh-mk Oct 19, 2023
958edc7
optim(user apis): remove unwanted exceptions
anirudh-mk Oct 19, 2023
7fe35ca
optim(register apis): remove unwanted exceptions
anirudh-mk Oct 19, 2023
96d1427
optim: remove unwanted exceptions
anirudh-mk Oct 19, 2023
a3043c8
Merge pull request #1381 from anirudh-mk/dev
adnankattekaden Oct 19, 2023
fb7352e
Merge pull request #1382 from gtech-mulearn/dev
adnankattekaden Oct 19, 2023
871bfff
feat(country api):add validation and response changed
anirudh-mk Oct 21, 2023
b2c108b
feat
anirudh-mk Oct 21, 2023
6ca4b8e
feat(state api):add validation and response changed
anirudh-mk Oct 21, 2023
85f1b1f
feat(zone api):add validation and response changed
anirudh-mk Oct 21, 2023
f587055
feat(district apis): reaponse changed and validation added
anirudh-mk Oct 21, 2023
e382320
Merge pull request #1383 from anirudh-mk/dev
adnankattekaden Oct 21, 2023
f4e7e20
Merge pull request #1384 from gtech-mulearn/dev
adnankattekaden Oct 21, 2023
b77e38e
[FEAT] Configure CustomException Error handling
MZaFaRM Oct 21, 2023
9a62058
[FEAT] Configure CustomException Error handling (#1385)
MZaFaRM Oct 21, 2023
f6c8724
Merge pull request #1386 from gtech-mulearn:dev
MZaFaRM Oct 21, 2023
95cad16
[PATCH] Log non-JSON data
MZaFaRM Oct 22, 2023
b4dfc6c
Merge pull request #1387 from gtech-mulearn/MZaFaRM-patch-1
MZaFaRM Oct 22, 2023
10499a6
[PATCH] Log non-JSON data (#1388)
MZaFaRM Oct 22, 2023
e5ebf54
universal handleer
adnankattekaden Oct 22, 2023
c1c7245
Merge remote-tracking branch 'origin/dev' into dev
adnankattekaden Oct 22, 2023
fd5e894
Merge pull request #1389 from adnankattekaden/dev
adnankattekaden Oct 22, 2023
4860118
Merge pull request #1390 from gtech-mulearn/dev
adnankattekaden Oct 22, 2023
c65d85d
profle fix
adnankattekaden Oct 22, 2023
c3753c3
Merge remote-tracking branch 'origin/dev' into dev
adnankattekaden Oct 22, 2023
013bf90
Merge pull request #1391 from adnankattekaden/dev
adnankattekaden Oct 22, 2023
549b086
Merge pull request #1392 from gtech-mulearn/dev
adnankattekaden Oct 22, 2023
d58ddc9
feat: ADDED support for lc member invitation via muid
suryan-s Oct 22, 2023
723c7e3
Merge branch 'gtech-mulearn:dev' into dev
suryan-s Oct 22, 2023
d4e1378
Merge pull request #1393 from suryan-s/dev
Oct 22, 2023
3efc1ce
Merge pull request #1394 from gtech-mulearn/dev
Oct 22, 2023
74c3b99
feat(karma_voucher): add create method
lordgrim18 Oct 22, 2023
9c65569
fix(karma_voucher): create method
lordgrim18 Oct 22, 2023
a937b96
Merge branch 'dev-server' of https://github.com/gtech-mulearn/mulearn…
MZaFaRM Oct 22, 2023
d80f743
[PATCH] Minor patch in middlewares
MZaFaRM Oct 22, 2023
6b49e4a
[PATCH] Minor patch in middlewares (#1397)
MZaFaRM Oct 22, 2023
e781150
[PATCH] Minor patch in middlewares (#1397) (#1398)
MZaFaRM Oct 22, 2023
3a474a9
[OPTIM] Organisation csv optimised
MZaFaRM Oct 22, 2023
0298874
feat(karma_voucher): add update and delete method
lordgrim18 Oct 22, 2023
0648fec
Merge branch 'dev' of https://github.com/lordgrim18/mulearnbackend in…
lordgrim18 Oct 22, 2023
a51ef95
Merge pull request #1399 from lordgrim18/dev
adnankattekaden Oct 22, 2023
76080ba
[PATCH] Minor patch in onboarding
MZaFaRM Oct 22, 2023
45675ec
Merge branch 'dev-server' of https://github.com/gtech-mulearn/mulearn…
MZaFaRM Oct 22, 2023
42650c8
Merge remote-tracking branch 'upstream/dev' into dev
MZaFaRM Oct 22, 2023
5a86051
[FEAT] Add gender, dob in register
MZaFaRM Oct 22, 2023
e2d401b
[PATCH] Minor patch in onboarding (#1400)
MZaFaRM Oct 22, 2023
675798c
[PATCH] Minor patch in onboarding (#1401)
MZaFaRM Oct 22, 2023
b9cd81d
[FEAT] User registration updates
MZaFaRM Oct 22, 2023
a03121e
Merge remote-tracking branch 'upstream/dev' into dev
MZaFaRM Oct 22, 2023
6ceaf21
Merge branch 'dev-server' of https://github.com/gtech-mulearn/mulearn…
MZaFaRM Oct 22, 2023
3b4e244
[FEAT] User registration updates (#1402)
MZaFaRM Oct 22, 2023
c47cecb
[FEAT] User registration update (#1403)
MZaFaRM Oct 22, 2023
298bdc8
feat(interest group api):sortable field added
anirudh-mk Oct 22, 2023
6f4a62d
feat(ig create update):validation added
anirudh-mk Oct 22, 2023
a2f7d74
feat(ig csv api):prafetch added
anirudh-mk Oct 22, 2023
8d6cdde
Merge remote-tracking branch 'origin/dev' into dev
anirudh-mk Oct 22, 2023
63386c4
Merge pull request #1404 from anirudh-mk/dev
adnankattekaden Oct 22, 2023
181edaf
Merge pull request #1405 from gtech-mulearn/dev
adnankattekaden Oct 22, 2023
11d000b
fix(karma_voucher): validate user method
lordgrim18 Oct 22, 2023
4c97bdd
Merge branch 'dev' of https://github.com/lordgrim18/mulearnbackend in…
lordgrim18 Oct 22, 2023
e785fda
Merge pull request #1406 from lordgrim18/dev
adnankattekaden Oct 23, 2023
d39cfde
Merge remote-tracking branch 'upstream/dev' into dev
MZaFaRM Oct 23, 2023
2eccd3a
Merge branch 'dev-server' of https://github.com/gtech-mulearn/mulearn…
MZaFaRM Oct 23, 2023
6243596
[STYLE] Styled db files
MZaFaRM Oct 23, 2023
4fd56f8
Merge pull request #1407 from MZaFaRM:dev
MZaFaRM Oct 23, 2023
11a1dc9
Merge pull request #1408 from gtech-mulearn:dev
MZaFaRM Oct 23, 2023
5029117
[STYLE, PATCH] Interest Group Patch, DB style
MZaFaRM Oct 23, 2023
72feffc
Merge remote-tracking branch 'upstream/dev' into dev
MZaFaRM Oct 23, 2023
156cebf
Merge branch 'dev-server' of https://github.com/gtech-mulearn/mulearn…
MZaFaRM Oct 23, 2023
e28c56b
Merge pull request #1409 from MZaFaRM:dev
MZaFaRM Oct 23, 2023
72eae39
Merge pull request #1410 from gtech-mulearn:dev
MZaFaRM Oct 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions api/dashboard/campus/campus_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,14 @@ class WeeklyKarmaAPI(APIView):

@role_required([RoleType.CAMPUS_LEAD.value, RoleType.ENABLER.value])
def get(self, request):
try:
user_id = JWTUtils.fetch_user_id(request)

user_org_link = get_user_college_link(user_id)
user_id = JWTUtils.fetch_user_id(request)

if user_org_link.org is None:
return CustomResponse(
general_message="Campus lead has no college"
).get_failure_response()
user_org_link = get_user_college_link(user_id)

serializer = serializers.WeeklyKarmaSerializer(user_org_link)
return CustomResponse(response=serializer.data).get_success_response()
if user_org_link.org is None:
return CustomResponse(
general_message="Campus lead has no college"
).get_failure_response()

except Exception as e:
raise CustomException(
detail='somthing went wrong',
status_code=403
)
serializer = serializers.WeeklyKarmaSerializer(user_org_link)
return CustomResponse(response=serializer.data).get_success_response()
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from utils.utils import DateTimeUtils
from utils.types import ManagementType


class DynamicRoleCreateSerializer(serializers.ModelSerializer):
type = serializers.CharField(required=True, error_messages={
'required': 'type field must not be left blank.'
Expand Down Expand Up @@ -43,7 +44,8 @@ def validate_type(self, value):
if value not in [type for type in ManagementType.get_all_values()]:
raise serializers.ValidationError("Enter a valid type")
return value



class DynamicRoleListSerializer(serializers.ModelSerializer):
roles = serializers.SerializerMethodField()

Expand All @@ -56,6 +58,7 @@ class Meta:
model = DynamicRole
fields = ["type", "roles"]


class DynamicRoleUpdateSerializer(serializers.ModelSerializer):
new_role = serializers.CharField(required=True, error_messages={
'required': 'new_role field must not be left blank.'
Expand Down Expand Up @@ -83,6 +86,7 @@ def validate_new_role(self, value):
def destroy(self, obj):
obj.delete()


class DynamicUserCreateSerializer(serializers.ModelSerializer):
type = serializers.CharField(required=True, error_messages={
'required': 'type field must not be left blank.'
Expand Down Expand Up @@ -119,7 +123,8 @@ def validate_type(self, value):
if value not in [type for type in ManagementType.get_all_values()]:
raise serializers.ValidationError("Enter a valid type")
return value



class DynamicUserListSerializer(serializers.ModelSerializer):
users = serializers.SerializerMethodField()

Expand All @@ -137,6 +142,7 @@ class Meta:
model = DynamicUser
fields = ["type", "users"]


class DynamicUserUpdateSerializer(serializers.ModelSerializer):
new_user = serializers.CharField(required=True, error_messages={
'required': 'new_user field must not be left blank.'
Expand Down Expand Up @@ -165,6 +171,7 @@ def validate_new_user(self, value):
def destroy(self, obj):
obj.delete()


class RoleDropDownSerializer(serializers.ModelSerializer):
class Meta:
model = Role
Expand Down
42 changes: 30 additions & 12 deletions api/dashboard/error_log/error_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,61 @@
class DownloadErrorLogAPI(APIView):
authentication_classes = [CustomizePermission]

@role_required([RoleType.ADMIN.value, RoleType.FELLOW.value, RoleType.TECH_TEAM.value])
@role_required(
[RoleType.ADMIN.value, RoleType.FELLOW.value, RoleType.TECH_TEAM.value]
)
def get(self, request, log_name):
error_log = f"{log_path}/{log_name}.log"
if os.path.exists(error_log):
response = FileResponse(open(error_log, 'rb'), content_type='application/octet-stream')
response['Content-Disposition'] = f'attachment; filename="{log_name}"'
response = FileResponse(
open(error_log, "rb"), content_type="application/octet-stream"
)
response["Content-Disposition"] = f'attachment; filename="{log_name}"'
return response
return CustomResponse(general_message=f"{log_name} Not Found").get_failure_response()
return CustomResponse(
general_message=f"{log_name} Not Found"
).get_failure_response()


class ViewErrorLogAPI(APIView):
authentication_classes = [CustomizePermission]

@role_required([RoleType.ADMIN.value, RoleType.FELLOW.value, RoleType.TECH_TEAM.value])
@role_required(
[RoleType.ADMIN.value, RoleType.FELLOW.value, RoleType.TECH_TEAM.value]
)
def get(self, request, log_name):
error_log = f"{log_path}/{log_name}.log"
if os.path.exists(error_log):
try:
with open(error_log, 'r') as log_file:
with open(error_log, "r") as log_file:
log_content = log_file.read()
return CustomResponse(response=log_content).get_success_response()
except Exception as e:
return CustomResponse(general_message=f'Error reading log file').get_failure_response()
return CustomResponse(
general_message="Error reading log file"
).get_failure_response()

return CustomResponse(general_message=f"{log_name} Not Found").get_failure_response()
return CustomResponse(
general_message=f"{log_name} Not Found"
).get_failure_response()


class ClearErrorLogAPI(APIView):
def get(self, request, log_name):
error_log = f"{log_path}/{log_name}.log"
if os.path.exists(error_log):
try:
with open(error_log, 'w') as log_file:
with open(error_log, "w") as log_file:
log_file.truncate(0)
return CustomResponse(general_message=f'{log_name} log cleared successfully').get_success_response()
return CustomResponse(
general_message=f"{log_name} log cleared successfully"
).get_success_response()
except Exception as e:
print(e)
return CustomResponse(general_message=f'Error reading log file').get_failure_response()
return CustomResponse(
general_message="Error reading log file"
).get_failure_response()

return CustomResponse(general_message=f"{log_name} Not Found").get_failure_response()
return CustomResponse(
general_message=f"{log_name} Not Found"
).get_failure_response()
54 changes: 6 additions & 48 deletions api/dashboard/ig/dash_ig_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,59 +28,17 @@ class Meta:
]

def get_user_ig_link_ig(self, obj):
return len(obj.user_ig_link_ig.all())
return obj.user_ig_link_ig.all().count()


class InterestGroupCreateSerializer(serializers.ModelSerializer):
class InterestGroupCreateUpdateSerializer(serializers.ModelSerializer):

name = serializers.CharField(
required=True,
error_messages={
'required': 'code field must not be left blank.'
}
)
icon = serializers.CharField(
required=True,
error_messages={
'required': 'icon field must not be left blank.'
}
)

class Meta:
model = InterestGroup
fields = [
"name",
"code",
"icon"
]

def create(self, validated_data):
user_id = self.context.get('user_id')
return InterestGroup.objects.create(
name=validated_data.get('name'),
code=validated_data.get('code'),
icon=validated_data.get('icon'),
updated_by_id=user_id,
created_by_id=user_id,
)


class InterestGroupUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = InterestGroup
fields = [
"name",
"code",
"icon"
]

def update(self, instance, validated_data):
user_id = self.context.get('user_id')
user = User.objects.filter(id=user_id).first()
instance.name = validated_data.get('name')
instance.code = validated_data.get('code')
instance.icon = validated_data.get('icon')
instance.updated_by = user
instance.updated_at = DateTimeUtils.get_current_utc_time()
instance.save()
return instance
"icon",
"created_by",
"updated_by"
]
Loading
Loading