Skip to content

Commit

Permalink
feat: add account ux columns
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Jun 3, 2024
1 parent 8f6f7d8 commit e1e7cfd
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 1 deletion.
101 changes: 101 additions & 0 deletions backend/apps/account/enums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# -*- coding: utf-8 -*-

from enum import Enum


class WorkArea(Enum, str):
TECNOLOGIA = "Tecnologia"
SAUDE = "Saúde"
FINANCEIRO = "Financeiro"
EDUCACAO = "Educação"
VAREJO = "Varejo"
ENERGIA = "Energia"
JORNALISMO = "Jornalismo"
OUTRA = "Outra"

@classmethod
def as_choices(cls):
return [(i.name, i.value) for i in cls]


class WorkRole(Enum, str):
CEO_DIRETOR = "CEO/Diretor(a)"
GERENTE = "Gerente"
COORDENADOR = "Coordenador(a)"
ANALISTA = "Analista"
CONSULTOR = "Consultor(a)"
ESPECIALISTA = "Especialista"
ASSISTENTE = "Assistente"
ESTAGIARIO = "Estagiário(a)"
ESTUDANTE = "Estudante"
PROFESSOR_PESQUISADOR = "Professor(a)/Pesquisador(a)"
FREELANCER = "Freelancer"
EMPREENDEDOR = "Empreendedor(a)"
OUTRO = "Outro"

@classmethod
def as_choices(cls):
return [(i.name, i.value) for i in cls]


class WorkSize(Enum, str):
PEQUENA_1_10 = "1-10 funcionários"
PEQUENA_11_50 = "11-50 funcionários"
MEDIA_51_200 = "51-200 funcionários"
MEDIA_201_500 = "201-500 funcionários"
GRANDE_MAIS_500 = "Mais de 500 funcionários"

@classmethod
def as_choices(cls):
return [(i.name, i.value) for i in cls]


class WorkDataTool(Enum, str):
SQL = "SQL"
PYTHON = "Python"
R = "R"
STATA = "Stata"
EXCEL = "Excel"
NONE = "Nenhuma"
OTHER = "Outra"

@classmethod
def as_choices(cls):
return [(i.name, i.value) for i in cls]


class WorkGoal(Enum, str):
MARKET_ANALYSIS = "Análise de mercado"
COMPETITOR_MONITORING = "Monitoramento de concorrência"
ACADEMIC_RESEARCH = "Pesquisa acadêmica"
RISK_MANAGEMENT = "Gestão de riscos"
PRODUCT_DEVELOPMENT = "Desenvolvimento de produto"
COMPLIANCE_REGULATORY = "Compliance e regulatório"
PUBLIC_POLICY_ANALYSIS = "Análise de políticas públicas"
OTHER = "Outro"

@classmethod
def as_choices(cls):
return [(i.name, i.value) for i in cls]


class DiscoveryMethod(Enum, str):
SOCIAL_MEDIA = "Redes sociais"
REFERRAL = "Indicação"
ONLINE_SEARCH = "Pesquisa online"
EVENTS = "Eventos"
ADVERTISING = "Publicidade"
OTHER = "Outros"

@classmethod
def as_choices(cls):
return [(i.name, i.value) for i in cls]


class AvailableForResearch(Enum, str):
YES = "Sim"
NO = "Não"

@classmethod
def as_choices(cls):
return [(i.name, i.value) for i in cls]
54 changes: 54 additions & 0 deletions backend/apps/account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
from django.db.models.query import QuerySet
from django.utils import timezone

from backend.apps.account.enums import (
AvailableForResearch,
DiscoveryMethod,
WorkArea,
WorkDataTool,
WorkGoal,
WorkRole,
WorkSize,
)
from backend.custom.graphql_jwt import owner_required
from backend.custom.model import BaseModel
from backend.custom.storage import OverwriteStorage, upload_to, validate_image
Expand Down Expand Up @@ -269,6 +278,51 @@ class Account(BaseModel, AbstractBaseUser, PermissionsMixin):
updated_at = models.DateTimeField(auto_now=True)
deleted_at = models.DateTimeField(null=True, blank=True)

# UX Research <
work_area = models.TextField(
null=True,
blank=True,
choices=WorkArea.as_choices(),
verbose_name="Área",
)
work_role = models.TextField(
null=True,
blank=True,
choices=WorkRole.as_choices(),
verbose_name="Cargo",
)
work_size = models.TextField(
null=True,
blank=True,
choices=WorkSize.as_choices(),
verbose_name="Tamanho da empresa",
)
work_goal = models.TextField(
null=True,
blank=True,
choices=WorkGoal.as_choices(),
verbose_name="Objetivo com a ONG",
)
work_data_tool = models.TextField(
null=True,
blank=True,
choices=WorkDataTool.as_choices(),
verbose_name="Ferramenta principal de análise de dados",
)
discovery_method = models.TextField(
null=True,
blank=True,
choices=DiscoveryMethod.as_choices(),
verbose_name="Como conheceu a ONG",
)
available_for_research = models.TextField(
null=True,
blank=True,
choices=AvailableForResearch.as_choices(),
verbose_name="Se gostaria de participar de pesquisas",
)
# UX Research >

objects = AccountManager()

graphql_fields_blacklist = [
Expand Down
2 changes: 1 addition & 1 deletion backend/apps/api/v1/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def get_form(self, request, obj=None, **kwargs):

def formfield_for_manytomany(self, db_field, request, **kwargs):
if self.current_obj and db_field.name == "raw_data_source":
kwargs["queryset"] = RawDataSource.objects.filter(dataset=self.current_obj.dataset)
kwargs["queryset"] = RawDataSource.objects.filter(dataset=self.current_obj.dataset)
return super().formfield_for_manytomany(db_field, request, **kwargs)


Expand Down

0 comments on commit e1e7cfd

Please sign in to comment.