Skip to content

Commit

Permalink
Merge pull request #34 from 50-Course/dev
Browse files Browse the repository at this point in the history
user module update
  • Loading branch information
50-Course committed May 3, 2024
2 parents 8c8dc63 + d17ed87 commit 71aa827
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 126 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
Empty file added .github/workflows/pipeline.yml
Empty file.
2 changes: 1 addition & 1 deletion backend/paycheck/paycheck
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from paycheck.manage import main
from src.paycheck.manage import main

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions backend/paycheck/requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pytest-cov==3.0.0
black==22.3.0
flake8==4.0.1
isort==5.10.1
factory-boy
Empty file.
58 changes: 57 additions & 1 deletion backend/paycheck/src/paycheck/IAM/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ def get_queryset(self) -> models.QuerySet:


class User(AbstractUser):
first_name = models.CharField(
_("First Name"),
help_text="Given name of the user",
max_length=40,
blank=False,
null=False,
)
last_name = models.CharField(
_("Last Name"),
help_text="Surname of the user",
max_length=40,
blank=False,
null=False,
)

REQUIRED_FIELDS = ["email"]
USERNAME_FIELD = "email"

Expand Down Expand Up @@ -91,7 +106,48 @@ class UserType(models.TextChoices):
)

def full_name(self) -> str:
return f"{self.user.first_name} {self.user.last_name}"
return f"{self.user}"

def __str__(self) -> str:
return f"{self.full_name()} - {self.user_type}"


class SupportUser(models.Model):
"""
Represent a member of the support team.
SupportUser is someone who is an admin with limited access to the system
They can:
- Manage disputes and resolutions on behalf of the user
- Manage user accounts
"""

user = models.OneToOneField(
_("Support"),
on_delete=models.CASCADE,
related_name="support_user",
help_text=_("Support User"),
)


class AdminUser(models.Model):
"""
Represent an admin user.
AdminUser is someone who is an admin with full access to the system
They can:
- Manage disputes and resolutions on behalf of the user
- Manage user accounts -blacklist or whitelist a user
- Manage user support staff
- Manage user support staff accounts
- Manage user support staff permissions
"""

user = models.OneToOneField(
_("Admin User"),
on_delete=models.CASCADE,
related_name="admin_user",
help_text=_("Admin User"),
)
11 changes: 11 additions & 0 deletions backend/paycheck/src/paycheck/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@
CACHES = {}
CACHES["default"]["BACKEND"] = "django.core.cache.backends.redis.RedisCache"
CACHES["default"]["OPTIONS"] = None

DATABASES["default"]["NAME"] = "paycheck-core-prod"
DATABASES["default"]["HOST"] = "paycheck-core-prod"
DATABASES["default"]["USER"] = "paycheck-core-prod"
DATABASES["default"]["PORT"] = 5432
DATABASES["default"]["PASSWORD"] = "paycheck-core-prod"
DATABASES["default"]["OPTIONS"] = {}

DEBUG = False

INSTALLED_APPS += []
124 changes: 0 additions & 124 deletions backend/paycheck/src/paycheck/config/settings_old.py

This file was deleted.

15 changes: 15 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.9'

# Environment variables
# ####################################################################################################
# # READ ME FIRST!
# #
# # ATTENTION: This file is used to build the docker image and run the container in development mode
#
# # For guide on how to run the application in development mode, see the README.md file
# #
# ####################################################################################################


services:

0 comments on commit 71aa827

Please sign in to comment.