-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* changing to SaaS * saas beta * restructuring * restruturing * restruturing * restruturing * restruturing * restruturing * added new api
- Loading branch information
KingCSharp
committed
Nov 9, 2020
1 parent
5f1b628
commit 7c85207
Showing
67 changed files
with
3,070 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.urls import path | ||
from accounts import api_views | ||
|
||
app_name = 'api_accounts' | ||
|
||
urlpatterns = [ | ||
path("accounts-list/", api_views.AccountsListView.as_view()), | ||
path("accounts-create/", api_views.CreateAccountView.as_view()), | ||
path("<int:pk>/view/", api_views.AccountDetailView.as_view()), | ||
path("accounts/<int:pk>/update/", api_views.AccountUpdateView.as_view()), | ||
path("accounts/<int:pk>/delete/", api_views.AccountDeleteView.as_view()), | ||
] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
from rest_framework import serializers | ||
from accounts.models import Account, Email, Tags | ||
from common.serializer import UserSerializer, CompanySerializer | ||
from leads.serializer import LeadSerializer | ||
from teams.serializer import TeamsSerializer | ||
from contacts.serializer import ContactSerializer | ||
|
||
|
||
class TagsSerailizer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Tags | ||
fields = ( | ||
"name", | ||
"slug" | ||
) | ||
|
||
|
||
class AccountSerializer(serializers.ModelSerializer): | ||
created_by = UserSerializer() | ||
lead = LeadSerializer() | ||
company = CompanySerializer() | ||
tags = TagsSerailizer(read_only=True, many=True) | ||
assigned_to = UserSerializer(read_only=True, many=True) | ||
contacts = ContactSerializer(read_only=True, many=True) | ||
teams = TeamsSerializer(read_only=True, many=True) | ||
|
||
class Meta: | ||
model = Account | ||
# fields = ‘__all__’ | ||
fields = ( | ||
'id', | ||
"name", | ||
"email", | ||
"phone", | ||
"industry", | ||
"billing_address_line", | ||
"billing_street", | ||
"billing_city", | ||
"billing_state", | ||
"billing_postcode", | ||
"billing_country", | ||
"website", | ||
"description", | ||
"created_by", | ||
"created_on", | ||
"is_active", | ||
"tags", | ||
"status", | ||
"lead", | ||
"contact_name", | ||
"contacts", | ||
"assigned_to", | ||
"teams", | ||
"company" | ||
) | ||
|
||
|
||
class EmailSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = Email | ||
fields = ( | ||
"from_account" | ||
"recipients" | ||
"message_subject" | ||
"message_body" | ||
"timezone" | ||
"scheduled_date_time" | ||
"scheduled_later" | ||
"created_on" | ||
"from_email" | ||
"rendered_message_body" | ||
) | ||
|
||
|
||
class EmailLogSerializer(serializers.ModelSerializer): | ||
email = EmailSerializer() | ||
|
||
class Meta: | ||
model = Email | ||
fields = ( | ||
"email" | ||
"contact" | ||
"is_sent" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from drf_yasg import openapi | ||
|
||
company_params_in_header = openapi.Parameter( | ||
'company', openapi.IN_HEADER, required=True, type=openapi.TYPE_STRING) | ||
|
||
|
||
account_list_get_params = [company_params_in_header] | ||
|
||
account_list_post_params = [company_params_in_header] | ||
|
||
account_create_get_params = [company_params_in_header] | ||
|
||
account_create_post_params = [ | ||
company_params_in_header, | ||
openapi.Parameter('name', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('phone', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('email', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_address_line', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_street', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_city', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_state', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_postcode', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_country', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('contacts', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
] | ||
|
||
|
||
account_update_get_params = [company_params_in_header] | ||
|
||
account_update_post_params = [ | ||
company_params_in_header, | ||
openapi.Parameter('name', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('phone', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('email', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_address_line', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_street', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_city', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_state', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_postcode', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('billing_country', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
openapi.Parameter('contacts', openapi.IN_QUERY, | ||
required=True, type=openapi.TYPE_STRING), | ||
] | ||
|
||
account_delete_params = [ | ||
company_params_in_header, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from rest_framework import serializers | ||
from cases.models import Case | ||
from common.serializer import UserSerializer, CompanySerializer | ||
from teams.serializer import TeamsSerializer | ||
from accounts.serializer import AccountSerializer | ||
from contacts.serializer import ContactSerializer | ||
|
||
|
||
class CaseSerializer(serializers.ModelSerializer): | ||
account = AccountSerializer(read_only=True, many=True) | ||
contacts = ContactSerializer(read_only=True, many=True) | ||
assigned_to = UserSerializer(read_only=True, many=True) | ||
created_by = UserSerializer(read_only=True) | ||
teams = TeamsSerializer(read_only=True, many=True) | ||
company = CompanySerializer() | ||
get_team_users = UserSerializer(read_only=True, many=True) | ||
get_team_and_assigned_users = UserSerializer(read_only=True, many=True) | ||
get_assigned_users_not_in_teams = UserSerializer(read_only=True, many=True) | ||
|
||
|
||
class Meta: | ||
model = Case | ||
fields = ( | ||
'id', | ||
'name', | ||
'status', | ||
'priority', | ||
'case_type', | ||
'account', | ||
'contacts', | ||
'closed_on', | ||
'description', | ||
'assigned_to', | ||
'created_by', | ||
'created_on', | ||
'is_active', | ||
'teams', | ||
'company', | ||
'get_team_users', | ||
'get_team_and_assigned_users', | ||
"get_assigned_users_not_in_teams", | ||
"created_on_arrow", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from django.urls import path | ||
from common import api_views | ||
|
||
|
||
app_name = "api_common" | ||
|
||
|
||
urlpatterns = [ | ||
path("dashboard/", api_views.ApiHomeView.as_view()), | ||
path("registration/", api_views.RegistrationView.as_view()), | ||
path("login/", api_views.LoginView.as_view()), | ||
path("validate-subdomain/", api_views.check_sub_domain), | ||
path("profile/", api_views.ProfileView.as_view()), | ||
path("get_teams_and_users/", api_views.GetTeamsAndUsersView.as_view()), | ||
path("change-password/", api_views.ChangePasswordView.as_view(), name="change_password"), | ||
path("forgot-password/", api_views.ForgotPasswordView.as_view()), | ||
path("reset-password/", api_views.ResetPasswordView.as_view(), name='reset_password'), | ||
path("users/list/", api_views.UsersListView.as_view(), name="users_list"), | ||
path("users/<int:pk>/view/", api_views.UserDetailView.as_view(), name="view_user"), | ||
# path("users/create/", api_views.CreateUserView.as_view(), name="create_user"), | ||
path("documents/create/", api_views.DocumentCreate.as_view(), name="create_doc"), | ||
#To be checked | ||
path("users/<int:pk>/delete/", api_views.UserDeleteView.as_view(), name="remove_user"), | ||
] |
Oops, something went wrong.