categories = new ArrayList<>();
13 |
14 | for(CategoryID categoryID : categoriesIDs){
15 | categories.add(categoryID.getDenomination().getDenomination());
16 | }
17 |
18 | CategoriesDTO categoriesDTO = new CategoriesDTO(categories);
19 | return categoriesDTO;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CheckIfSiblingsDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CheckIfSiblingsDTO;
4 |
5 | /**
6 | * The type Check if siblings dto assembler.
7 | *
8 | * @author Ala Matos
9 | */
10 | public class CheckIfSiblingsDTOAssembler {
11 | /**
12 | * Create dto from primitive types check if siblings dto.
13 | *
14 | * @param email the email
15 | * @param siblingsEmail the siblings email
16 | * @return the check if siblings dto
17 | */
18 | public static CheckIfSiblingsDTO createDTOFromPrimitiveTypes(String email, String siblingsEmail) {
19 | CheckIfSiblingsDTO checkIfSiblingsDTO = new CheckIfSiblingsDTO(email, siblingsEmail);
20 | return checkIfSiblingsDTO;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CreateGroupAccountDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CreateGroupAccountDTO;
4 |
5 | /**
6 | * The type Create group account dto assembler.
7 | */
8 | public class CreateGroupAccountDTOAssembler {
9 |
10 | /**
11 | * Create dto from primitive types create group account dto.
12 | *
13 | * @param personEmail the person email
14 | * @param groupDenomination the group denomination
15 | * @param accountDescription the account description
16 | * @param accountDenomination the account denomination
17 | * @return the create group account dto
18 | */
19 | public static CreateGroupAccountDTO createDTOFromPrimitiveTypes(String personEmail, String groupDenomination, String accountDescription, String accountDenomination) {
20 | CreateGroupAccountDTO createGroupAccountDTO = new CreateGroupAccountDTO(personEmail, groupDenomination, accountDescription, accountDenomination);
21 | return createGroupAccountDTO;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CreateGroupCategoryDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CreateGroupCategoryDTO;
4 |
5 | /**
6 | * The type Create group category dto assembler.
7 | */
8 | public class CreateGroupCategoryDTOAssembler {
9 |
10 | /**
11 | * Create dto from primitive types create group category dto.
12 | *
13 | * @param personEmail the person email
14 | * @param groupDenomination the group denomination
15 | * @param categoryDenomination the category denomination
16 | * @return the create group category dto
17 | */
18 | public static CreateGroupCategoryDTO createDTOFromPrimitiveTypes(String personEmail, String groupDenomination, String categoryDenomination) {
19 | CreateGroupCategoryDTO createGroupCategoryDTO = new CreateGroupCategoryDTO(personEmail, groupDenomination, categoryDenomination);
20 | return createGroupCategoryDTO;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CreateGroupDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CreateGroupDTO;
4 |
5 | /**
6 | * The type Create group dto assembler.
7 | */
8 | public class CreateGroupDTOAssembler {
9 |
10 | /**
11 | * Create dto from primitve types create group dto.
12 | *
13 | * @param email the email
14 | * @param denomination the denomination
15 | * @param description the description
16 | * @return the create group dto
17 | */
18 | public static CreateGroupDTO createDTOFromPrimitiveTypes(String email, String denomination, String description) {
19 | return new CreateGroupDTO(email, denomination, description);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CreatePersonAccountDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CreatePersonAccountDTO;
4 |
5 | /**
6 | * The type Create person account dto assembler.
7 | */
8 | public class CreatePersonAccountDTOAssembler {
9 |
10 | /**
11 | * Create dto from primitve types create person account dto.
12 | *
13 | * @param email the email
14 | * @param denomination the denomination
15 | * @param description the description
16 | * @return the create person account dto
17 | */
18 | public static CreatePersonAccountDTO createDTOFromPrimitiveTypes(String email, String description, String denomination) {
19 | CreatePersonAccountDTO createPersonAccountDTO = new CreatePersonAccountDTO(email, description, denomination);
20 | return createPersonAccountDTO;
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CreatePersonCategoryDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CreatePersonCategoryDTO;
4 |
5 | /**
6 | * The type Create person category dto assembler.
7 | */
8 | public class CreatePersonCategoryDTOAssembler {
9 |
10 | /**
11 | * Create dto from primitve types create person category dto.
12 | *
13 | * @param email the email
14 | * @param denomination the denomination
15 | * @return the create person category dto
16 | */
17 | public static CreatePersonCategoryDTO createDTOFromPrimitiveTypes(String email,String denomination) {
18 | CreatePersonCategoryDTO createPersonCategoryDTO = new CreatePersonCategoryDTO(email, denomination);
19 | return createPersonCategoryDTO;
20 | }
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CreatePersonDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CreatePersonDTO;
4 |
5 | import java.time.LocalDate;
6 | import java.time.format.DateTimeFormatter;
7 |
8 | /**
9 | * The type Create person dto assembler.
10 | */
11 |
12 | public class CreatePersonDTOAssembler {
13 |
14 | /**
15 | * Create dto from primitve types create group dto.
16 | *
17 | * @param email the email
18 | * @param name the name
19 | * @param birthdate the birthdate
20 | * @param birthplace the birthplace
21 | * @return the create person dto
22 | */
23 |
24 | public static CreatePersonDTO createDTOFromPrimitiveTypes(String email, String name, String birthdate, String birthplace) {
25 |
26 | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
27 |
28 | LocalDate localDateBirthdate = LocalDate.parse(birthdate, formatter);
29 |
30 | return new CreatePersonDTO(email, name, localDateBirthdate, birthplace);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/CreatePersonTransactionDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.CreatePersonTransactionDTO;
4 |
5 | /**
6 | * The type Create person transaction dto assembler.
7 | */
8 | public class CreatePersonTransactionDTOAssembler {
9 |
10 | private CreatePersonTransactionDTOAssembler() {
11 | }
12 |
13 | /**
14 | * Create dto from primitve types create person transaction dto.
15 | *
16 | * @param email the email
17 | * @param denominationCategory the denomination category
18 | * @param type the type
19 | * @param description the description
20 | * @param amount the amount
21 | * @param denominationAccountDeb the denomination account deb
22 | * @param denominationAccountCred the denomination account cred
23 | * @return the create person transaction dto
24 | */
25 | public static CreatePersonTransactionDTO createDTOFromPrimitiveTypes(String email, String denominationCategory, String type, String description, double amount, String denominationAccountDeb, String denominationAccountCred, String date) {
26 | CreatePersonTransactionDTO createPersonTransactionDTO = new CreatePersonTransactionDTO(email, denominationCategory, type, description, amount, denominationAccountDeb, denominationAccountCred, date);
27 | return createPersonTransactionDTO;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/DeleteGroupTransactionDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.DeleteGroupTransactionDTO;
4 |
5 | /**
6 | * The type Create group transaction dto assembler.
7 | *
8 | * @author SWitCH 2019/2020 Group 3
9 | * @author Joana Correia
10 | * @version %I%, %G% CreateGroupTransactionByMemberDTOAssembler class defines the DTO responsible for: - transfer data required to create a group transaction by a member of the group
11 | */
12 | public class DeleteGroupTransactionDTOAssembler {
13 |
14 | /**
15 | * Create dto from primitive types create group transaction dto.
16 | *
17 | * @param groupDenomination Name of the group where the transaction refers to
18 | * @param personGroupMemberEmail Email of the member of the group that wants to add the transaction
19 | * @return CreateGroupTransactionByMemberDTO createGroupTransactionByMemberDTO
20 | */
21 | public static DeleteGroupTransactionDTO createDTOFromPrimitiveTypes(int transactionNumber, String groupDenomination, String personGroupMemberEmail) {
22 | DeleteGroupTransactionDTO deleteGroupTransactionDTO = new DeleteGroupTransactionDTO(transactionNumber, groupDenomination, personGroupMemberEmail);
23 | return deleteGroupTransactionDTO;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/DeletePersonTransactionDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.DeletePersonTransactionDTO;
4 |
5 | public class DeletePersonTransactionDTOAssembler {
6 |
7 | private DeletePersonTransactionDTOAssembler() {
8 | }
9 |
10 | public static DeletePersonTransactionDTO createDTOFromPrimitiveTypes(int transactionNumber, String email) {
11 | DeletePersonTransactionDTO deletePersonTransactionDTO = new DeletePersonTransactionDTO(transactionNumber, email);
12 | return deletePersonTransactionDTO;
13 |
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupAdminsDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupAdminsDTO;
4 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | public class GroupAdminsDTOAssembler {
10 |
11 | public static GroupAdminsDTO createDTOFromDomainObject(List peopleInCharge) {
12 | List admins = new ArrayList<>();
13 |
14 | for(PersonID personID : peopleInCharge){
15 | admins.add(personID.getEmail().getEmail());
16 | }
17 |
18 | GroupAdminsDTO groupAdminsDTO = new GroupAdminsDTO(admins);
19 | return groupAdminsDTO;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupAllMembersDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupAllMembersDTO;
4 | import com.finance.project.dtos.dtos.GroupMemberClearanceDTO;
5 |
6 | import java.util.List;
7 |
8 | public class GroupAllMembersDTOAssembler {
9 |
10 | public static GroupAllMembersDTO createDTOFromDomainObject(List allMembers) {
11 |
12 | GroupAllMembersDTO groupAllMembersDTO = new GroupAllMembersDTO(allMembers);
13 | return groupAllMembersDTO;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupIDDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupIDDTO;
4 | import com.finance.project.domainLayer.domainEntities.vosShared.GroupID;
5 |
6 | /**
7 | * The type Group iddto assembler.
8 | */
9 | public class GroupIDDTOAssembler {
10 |
11 | /**
12 | * Create dto from domain object group iddto.
13 | *
14 | * @param groupID the group id
15 | * @return the group iddto
16 | */
17 | public static GroupIDDTO createDTOFromDomainObject(GroupID groupID) {
18 | GroupIDDTO groupIDDTO = new GroupIDDTO(groupID.getDenomination().getDenomination());
19 | return groupIDDTO;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupListDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupDTO;
4 | import com.finance.project.dtos.dtos.GroupListDTO;
5 |
6 | import java.util.List;
7 |
8 | public class GroupListDTOAssembler {
9 |
10 | public static GroupListDTO createDTOFromDomainObject(List listOfGroupDTO) {
11 |
12 | GroupListDTO groupListDTO = new GroupListDTO(listOfGroupDTO);
13 | return groupListDTO;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupMemberClearanceDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupMemberClearanceDTO;
4 |
5 | public class GroupMemberClearanceDTOAssembler {
6 |
7 | public static GroupMemberClearanceDTO createDTOFromDomainObject(String memberID, String clearance) {
8 |
9 | GroupMemberClearanceDTO groupMemberClearanceDTO = new GroupMemberClearanceDTO(memberID, clearance);
10 | return groupMemberClearanceDTO;
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupMembersDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
4 | import com.finance.project.dtos.dtos.GroupMembersDTO;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | public class GroupMembersDTOAssembler {
10 |
11 | public static GroupMembersDTO createDTOFromDomainObject(List members) {
12 | List groupMembers = new ArrayList<>();
13 |
14 | for(PersonID personID : members){
15 | groupMembers.add(personID.getEmail().getEmail());
16 | }
17 |
18 | GroupMembersDTO groupMembersDTO = new GroupMembersDTO(groupMembers);
19 | return groupMembersDTO;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupSearchAccountRecordsInDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupSearchAccountRecordsInDTO;
4 |
5 | /**
6 | * DTO Assembler in - For retrieving the list of transactions of the group, by a member,
7 | * for a given account, within a given period.
8 | */
9 | public class GroupSearchAccountRecordsInDTOAssembler {
10 |
11 | /**
12 | * Instantiates a new Group search account records in dto assembler.
13 | */
14 | public GroupSearchAccountRecordsInDTOAssembler() {
15 | }
16 |
17 | /**
18 | * Creates a DTO (in) for retrieving the group transactions, by a member,
19 | * for a given account, within a given period.
20 | *
21 | * @param personEmail the person email (group member)
22 | * @param groupDenomination the group denomination
23 | * @param accountDenomination the denomination of the account to search
24 | * @param startDate the start date of the period to search
25 | * @param endDate the end date of the period to search
26 | * @return the DTO (in) for retrieving the group transactions, by a member,
27 | * for a given account, within a given period
28 | */
29 | public static GroupSearchAccountRecordsInDTO groupSearchAccountRecordsInDTO(String personEmail, String groupDenomination, String accountDenomination, String startDate, String endDate) {
30 | GroupSearchAccountRecordsInDTO groupSearchAccountRecordsInDTO = new GroupSearchAccountRecordsInDTO(personEmail, groupDenomination, accountDenomination, startDate, endDate);
31 | return groupSearchAccountRecordsInDTO;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupTransactionsWithinPeriodDTOinAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupTransactionsWithinPeriodDTOin;
4 |
5 | import java.time.LocalDate;
6 |
7 | /**
8 | * The type Group transactions within period dt oin assembler.
9 | */
10 | public class GroupTransactionsWithinPeriodDTOinAssembler {
11 |
12 | /**
13 | * Create group transactions within period dt oin group transactions within period dt oin.
14 | *
15 | * @param personEmail the person email
16 | * @param groupDenomination the group denomination
17 | * @param startDate the start date
18 | * @param endDate the end date
19 | * @return the group transactions within period dt oin
20 | */
21 | public static GroupTransactionsWithinPeriodDTOin createGroupTransactionsWithinPeriodDTOin(String personEmail, String groupDenomination, LocalDate startDate, LocalDate endDate){
22 | GroupTransactionsWithinPeriodDTOin groupTransactionsWithinPeriodDTOin = new GroupTransactionsWithinPeriodDTOin(personEmail, groupDenomination,startDate,endDate);
23 | return groupTransactionsWithinPeriodDTOin;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupTransactionsWithinPeriodDTOoutAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupTransactionsWithinPeriodDTOout;
4 | import com.finance.project.dtos.dtos.TransactionDTOout;
5 | import com.finance.project.domainLayer.domainEntities.aggregates.ledger.Transaction;
6 |
7 | import java.util.ArrayList;
8 |
9 |
10 | public final class GroupTransactionsWithinPeriodDTOoutAssembler {
11 |
12 | private GroupTransactionsWithinPeriodDTOoutAssembler() {
13 | }
14 |
15 |
16 | public static GroupTransactionsWithinPeriodDTOout getGroupTransactionsWithinPeriodDTOout(ArrayList transactions) {
17 |
18 | GroupTransactionsWithinPeriodDTOout groupTransactionsWithinPeriodDTOout = new GroupTransactionsWithinPeriodDTOout();
19 | for (Transaction transaction : transactions) {
20 | TransactionDTOout transactionDTOout = TransactionDTOoutAssembler.createTransactionDTOout(transaction);
21 | groupTransactionsWithinPeriodDTOout.getTransactionsList().add(transactionDTOout);
22 | }
23 | return groupTransactionsWithinPeriodDTOout;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/GroupsThatAreFamilyDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.GroupIDDTO;
4 | import com.finance.project.dtos.dtos.GroupsThatAreFamilyDTO;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * The type Groups that are family dto assembler.
10 | */
11 | public class GroupsThatAreFamilyDTOAssembler {
12 |
13 | /**
14 | * Create dto from domain object groups that are family dto.
15 | *
16 | * @param listOfGroupIDDTO the list of group iddto
17 | * @return the groups that are family dto
18 | */
19 | public static GroupsThatAreFamilyDTO createDTOFromDomainObject(List listOfGroupIDDTO) {
20 |
21 | GroupsThatAreFamilyDTO groupsThatAreFamilyDTO = new GroupsThatAreFamilyDTO(listOfGroupIDDTO);
22 | return groupsThatAreFamilyDTO;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/PersonEmailDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.PersonEmailDTO;
4 |
5 | /**
6 | * @author Ala Matos
7 | */
8 |
9 | public class PersonEmailDTOAssembler {
10 |
11 | /**
12 | * Create dto from primitive types boolean dto.
13 | *
14 | * @param email
15 | * @return the PersonEmailDTO
16 | */
17 |
18 | public static PersonEmailDTO createPersonEmailDTO(String email) {
19 | return new PersonEmailDTO(email);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/PersonSearchAccountRecordsInDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.PersonSearchAccountRecordsInDTO;
4 |
5 | /**
6 | * DTO Assembler in - For retrieving the list of transactions of a person, for a given account, within a given period.
7 | */
8 |
9 | public class PersonSearchAccountRecordsInDTOAssembler {
10 |
11 | private PersonSearchAccountRecordsInDTOAssembler() {
12 | }
13 |
14 | /**
15 | * Creates a DTO (in) for retrieving a person's transactions, for a given account, within a given period.
16 | *
17 | * @param personEmail the person email
18 | * @param accountDenomination the denomination of the account to search
19 | * @param startDate the start date of the period to search
20 | * @param endDate the end date of the period to search
21 | * @return Assembles the DTO (in) for retrieving a person's transactions, for a given account, within a given period
22 | */
23 | public static PersonSearchAccountRecordsInDTO personAccountTransactionsInDTO(String personEmail, String accountDenomination, String startDate, String endDate) {
24 | PersonSearchAccountRecordsInDTO personSearchAccountRecordsInDTO = new PersonSearchAccountRecordsInDTO(personEmail, accountDenomination, startDate, endDate);
25 | return personSearchAccountRecordsInDTO;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/SearchAccountRecordsOutDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.PersonSearchAccountRecordsOutDTO;
4 | import com.finance.project.dtos.dtos.TransactionDTOout;
5 | import com.finance.project.domainLayer.domainEntities.aggregates.ledger.Transaction;
6 |
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * DTO Assembler out - Info for delivering the list of transactions of a person, for a given account, within a given period.
11 | */
12 |
13 | public class SearchAccountRecordsOutDTOAssembler {
14 |
15 | private SearchAccountRecordsOutDTOAssembler() {
16 | }
17 |
18 | /**
19 | * Creates a DTO (out) for delivering a person's transactions, for a given account, within a given period.
20 | *
21 | * @param transactions the list of transactions
22 | * @return Assembles the DTO (out) for delivering a person's transactions, for a given account, within a given period
23 | */
24 | public static PersonSearchAccountRecordsOutDTO accountTransactionsOutDTO(ArrayList transactions) {
25 |
26 | PersonSearchAccountRecordsOutDTO personSearchAccountRecordsOutDTO = new PersonSearchAccountRecordsOutDTO();
27 |
28 | for (Transaction transaction : transactions) {
29 | TransactionDTOout transactionDTOout = TransactionDTOoutAssembler.createTransactionDTOout(transaction);
30 | personSearchAccountRecordsOutDTO.getTransactions().add(transactionDTOout);
31 | }
32 | return personSearchAccountRecordsOutDTO;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/SiblingsDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
4 | import com.finance.project.dtos.dtos.SiblingsDTO;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | public class SiblingsDTOAssembler {
10 |
11 | public static SiblingsDTO createDTOFromDomainObject(List siblings) {
12 | List personSiblings = new ArrayList<>();
13 |
14 | for(PersonID personID : siblings){
15 | personSiblings.add(personID.getEmail().getEmail());
16 | }
17 |
18 | SiblingsDTO siblingsDTO = new SiblingsDTO(personSiblings);
19 | return siblingsDTO;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/TransactionDTOoutAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.aggregates.ledger.Transaction;
4 | import com.finance.project.dtos.dtos.TransactionDTOout;
5 |
6 | /**
7 | * The type Transaction dt oout assembler.
8 | */
9 | public class TransactionDTOoutAssembler {
10 | private TransactionDTOoutAssembler() {
11 | }
12 |
13 | /**
14 | * Create transaction dt oout transaction dt oout.
15 | *
16 | * @param transaction the transaction
17 | * @return the transaction dt oout
18 | */
19 | public static TransactionDTOout createTransactionDTOout (Transaction transaction){
20 | TransactionDTOout transactionDTOout = new TransactionDTOout();
21 | transactionDTOout.setCategory(transaction.getCategoryID().getDenomination().getDenomination());
22 | transactionDTOout.setType(transaction.getType().getType());
23 | transactionDTOout.setDescription(transaction.getDescription().getDescription());
24 | transactionDTOout.setAmount(transaction.getAmount().getAmount());
25 | transactionDTOout.setDate(transaction.getDate().getDate().toString());
26 | transactionDTOout.setDebitAccount(transaction.getDebitAccountID().getDenomination().getDenomination());
27 | transactionDTOout.setCreditAccount(transaction.getCreditAccountID().getDenomination().getDenomination());
28 | return transactionDTOout;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/TransactionsDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.TransactionDTOout;
4 | import com.finance.project.dtos.dtos.TransactionsDTO;
5 |
6 | import java.util.List;
7 |
8 | public class TransactionsDTOAssembler {
9 |
10 | public static TransactionsDTO createDTOFromPrimitiveTypes(List transactions) {
11 |
12 | TransactionsDTO transactionsDTO = new TransactionsDTO(transactions);
13 | return transactionsDTO;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/dtos/dtosAssemblers/UpdatePersonTransactionDTOAssembler.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.dtos.dtos.UpdatePersonTransactionDTO;
4 |
5 | public class UpdatePersonTransactionDTOAssembler {
6 |
7 | private UpdatePersonTransactionDTOAssembler() {
8 | }
9 |
10 | public static UpdatePersonTransactionDTO createDTOFromPrimitiveTypes(int transactionNumber, String email, String denominationCategory, String type, String description, double amount, String denominationAccountDeb, String denominationAccountCred) {
11 | UpdatePersonTransactionDTO updatePersonTransactionDTO = new UpdatePersonTransactionDTO(transactionNumber, email, denominationCategory, type, description, amount, denominationAccountDeb, denominationAccountCred);
12 | return updatePersonTransactionDTO;
13 |
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/infrastructureLayer/infrastructureLayer_here.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/backend/src/main/java/com/finance/project/infrastructureLayer/infrastructureLayer_here.txt
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/jpa_repos_here.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/backend/src/main/java/com/finance/project/persistenceLayer/jpa_repos_here.txt
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/AccountJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 | import com.finance.project.dataModel.dataModel.AbstractIdJpa;
4 | import com.finance.project.dataModel.dataModel.AccountJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | import java.util.List;
8 | import java.util.Optional;
9 |
10 | public interface AccountJpaRepository extends CrudRepository {
11 |
12 | List findAll();
13 |
14 | Optional findById(AbstractIdJpa id);
15 |
16 | boolean existsById(AbstractIdJpa id);
17 |
18 | long count();
19 |
20 | void delete(AccountJpa accountJpa);
21 |
22 | List findAllById(AbstractIdJpa id);
23 | }
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/AddressJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 |
4 | import com.finance.project.dataModel.dataModel.AddressJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | import java.util.List;
8 | import java.util.Optional;
9 |
10 | public interface AddressJpaRepository extends CrudRepository {
11 |
12 | Optional findById(long id);
13 | List findAll();
14 | }
15 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/AdminJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 |
4 | import com.finance.project.dataModel.dataModel.AdminJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | import java.util.List;
8 |
9 | public interface AdminJpaRepository extends CrudRepository {
10 |
11 | AdminJpa findById(long id);
12 |
13 | List findAll();
14 | }
15 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/CategoryJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 | import com.finance.project.dataModel.dataModel.AbstractIdJpa;
4 | import com.finance.project.dataModel.dataModel.CategoryJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | import java.util.List;
8 | import java.util.Optional;
9 |
10 | public interface CategoryJpaRepository extends CrudRepository {
11 |
12 | List findAll();
13 |
14 | Optional findById(AbstractIdJpa id);
15 |
16 | boolean existsById(AbstractIdJpa id);
17 |
18 | long count();
19 |
20 | void delete(CategoryJpa categoryJpa);
21 |
22 | List findAllById(AbstractIdJpa id);
23 | }
24 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/GroupJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 |
4 | import com.finance.project.dataModel.dataModel.GroupJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 | import com.finance.project.domainLayer.domainEntities.vosShared.GroupID;
7 |
8 | import java.util.List;
9 | import java.util.Optional;
10 |
11 | public interface GroupJpaRepository extends CrudRepository {
12 |
13 | List findAll();
14 |
15 | Optional findById(GroupID id);
16 |
17 | boolean existsById(GroupID id);
18 |
19 | long count();
20 | }
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/LedgerJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 | import com.finance.project.dataModel.dataModel.LedgerJpa;
4 | import org.springframework.data.repository.CrudRepository;
5 | import com.finance.project.domainLayer.domainEntities.vosShared.LedgerID;
6 |
7 | import java.util.List;
8 | import java.util.Optional;
9 |
10 | public interface LedgerJpaRepository extends CrudRepository {
11 |
12 | List findAll();
13 |
14 | Optional findById(LedgerID id);
15 |
16 | boolean existsById(LedgerID id);
17 |
18 | long count();
19 | }
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/MemberJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 |
4 | import com.finance.project.dataModel.dataModel.MemberJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | import java.util.List;
8 |
9 | public interface MemberJpaRepository extends CrudRepository {
10 |
11 | MemberJpa findById(long id);
12 |
13 | List findAll();
14 | }
15 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/PersonJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 |
4 | import com.finance.project.dataModel.dataModel.PersonJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
7 |
8 | import java.util.List;
9 | import java.util.Optional;
10 |
11 | public interface PersonJpaRepository extends CrudRepository {
12 |
13 | List findAll();
14 |
15 | Optional findById(PersonID id);
16 |
17 | boolean existsById(PersonID id);
18 |
19 | long count();
20 |
21 | void delete(PersonJpa personJpa);
22 | }
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/SiblingJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 |
4 | import com.finance.project.dataModel.dataModel.SiblingJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | import java.util.List;
8 |
9 | public interface SiblingJpaRepository extends CrudRepository {
10 |
11 | SiblingJpa findById(long id);
12 |
13 | List findAll();
14 | }
15 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/finance/project/persistenceLayer/repositoriesJPA/TransactionJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.persistenceLayer.repositoriesJPA;
2 |
3 | import com.finance.project.dataModel.dataModel.LedgerJpa;
4 | import com.finance.project.dataModel.dataModel.TransactionJpa;
5 | import org.springframework.data.repository.CrudRepository;
6 |
7 | import java.util.List;
8 | import java.util.Optional;
9 |
10 |
11 | public interface TransactionJpaRepository extends CrudRepository {
12 |
13 | List findAll();
14 |
15 | Optional findById(Long id);
16 |
17 | List findAllByLedger(LedgerJpa id);
18 | }
--------------------------------------------------------------------------------
/backend/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.h2.console.enabled=true
2 | spring.h2.console.path=/h2-console
3 | spring.jpa.hibernate.ddl-auto=create-drop
4 |
5 | # http://localhost:8080/h2-console/
6 |
7 | # JDBC URL: jdbc:h2:mem:testdb
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/TestConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.finance.project;
2 |
3 | import com.finance.project.applicationLayer.applicationServices.groupServices.*;
4 | import com.finance.project.applicationLayer.applicationServices.otherServices.CheckSiblingsService;
5 | import com.finance.project.applicationLayer.applicationServices.otherServices.CheckGroupsFamilyService;
6 | import com.finance.project.applicationLayer.applicationServices.personServices.*;
7 | import org.springframework.boot.test.mock.mockito.MockBean;
8 | import org.springframework.context.annotation.Configuration;
9 | import org.springframework.context.annotation.Profile;
10 |
11 |
12 | @Profile("test")
13 |
14 | @Configuration
15 |
16 |
17 | public class TestConfiguration {
18 |
19 | // Person Services
20 |
21 | @MockBean
22 | public CreatePersonService createPersonService;
23 |
24 | @MockBean
25 | public CreatePersonCategoryService createPersonCategoryService;
26 |
27 | @MockBean
28 | public CreatePersonAccountService createPersonAccountService;
29 |
30 | @MockBean
31 | public CreatePersonTransactionService createPersonTransactionService;
32 |
33 | @MockBean
34 | public PersonSearchAccountRecordsService personSearchAccountRecordsService;
35 |
36 |
37 | // Group Services
38 |
39 | @MockBean
40 | public CreateGroupService createGroupService;
41 |
42 | @MockBean
43 | public AddPersonToGroupService uS003AddPersonToGroupService;
44 |
45 | @MockBean
46 | public CreateGroupCategoryService createGroupCategoryService;
47 |
48 | @MockBean
49 | public CreateGroupAccountService createGroupAccountService;
50 |
51 | @MockBean
52 | public CreateGroupTransactionService createGroupTransactionService;
53 |
54 | @MockBean
55 | public GroupSearchAccountRecordsService groupSearchAccountRecordsService;
56 |
57 |
58 | // Other Services
59 |
60 | @MockBean
61 | private CheckSiblingsService checkSiblingsService;
62 |
63 | @MockBean
64 | public CheckGroupsFamilyService checkGroupsFamilyService;
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/applicationLayer/services_here.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/backend/src/test/java/com/finance/project/applicationLayer/services_here.txt
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/controllerLayer/integrationTests/CreatePersonCategoryControllerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.controllerLayer.integrationTests;
2 |
3 | import com.finance.project.applicationLayer.applicationServices.personServices.CreatePersonCategoryService;
4 | import org.json.JSONObject;
5 | import org.junit.jupiter.api.Assertions;
6 | import org.junit.jupiter.api.BeforeAll;
7 | import org.junit.jupiter.api.Test;
8 | import org.junit.jupiter.api.TestInstance;
9 | import org.springframework.boot.jdbc.EmbeddedDatabaseConnection;
10 | import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
11 | import org.springframework.http.HttpStatus;
12 | import org.springframework.http.MediaType;
13 | import org.springframework.test.web.servlet.MvcResult;
14 | import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
15 | import com.finance.project.dtos.dtos.NewPersonCategoryInfoDTO;
16 |
17 | import java.time.LocalDate;
18 |
19 | import static org.junit.jupiter.api.Assertions.assertEquals;
20 | import static org.junit.jupiter.api.Assertions.assertTrue;
21 |
22 | @TestInstance(TestInstance.Lifecycle.PER_CLASS)
23 | @AutoConfigureTestDatabase(connection = EmbeddedDatabaseConnection.H2)
24 | class CreatePersonCategoryControllerTest extends AbstractTest {
25 |
26 | @Override
27 | @BeforeAll
28 | public void setUp() {
29 | super.setUp();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/controllerLayer/integrationTests/CreatePersonTransactionControllerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.controllerLayer.integrationTests;
2 |
3 | import org.json.JSONObject;
4 | import org.junit.jupiter.api.*;
5 | import org.springframework.boot.jdbc.EmbeddedDatabaseConnection;
6 | import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
7 | import org.springframework.http.HttpStatus;
8 | import org.springframework.http.MediaType;
9 | import org.springframework.test.web.servlet.MvcResult;
10 | import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
11 | import com.finance.project.dtos.dtos.NewPersonTransactionInfoDTO;
12 |
13 | import java.time.LocalDate;
14 |
15 | import static org.junit.jupiter.api.Assertions.assertEquals;
16 | import static org.junit.jupiter.api.Assertions.assertTrue;
17 |
18 | @TestInstance(TestInstance.Lifecycle.PER_CLASS)
19 | @AutoConfigureTestDatabase(connection = EmbeddedDatabaseConnection.H2)
20 | @TestMethodOrder(MethodOrderer.Alphanumeric.class)
21 | public class CreatePersonTransactionControllerTest extends AbstractTest {
22 |
23 | @Override
24 | @BeforeAll
25 | public void setUp() {
26 | super.setUp();
27 | }
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/controllerLayer/unitTests/CreateGroupControllerRESTTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.controllerLayer.unitTests;
2 |
3 | import com.finance.project.applicationLayer.applicationServices.groupServices.CreateGroupService;
4 | import com.finance.project.controllerLayer.controllersREST.groupControllers.CreateGroupControllerREST;
5 | import com.finance.project.controllerLayer.integrationTests.AbstractTest;
6 | import com.finance.project.domainLayer.domainEntities.aggregates.ledger.Transaction;
7 | import com.finance.project.domainLayer.domainEntities.vosShared.*;
8 | import com.finance.project.domainLayer.entitiesInterfaces.OwnerID;
9 | import com.finance.project.domainLayer.exceptions.InvalidArgumentsBusinessException;
10 | import com.finance.project.domainLayer.exceptions.NotFoundArgumentsBusinessException;
11 | import com.finance.project.dtos.dtos.*;
12 | import com.finance.project.dtos.dtosAssemblers.*;
13 | import org.junit.jupiter.api.Test;
14 | import org.mockito.Mock;
15 | import org.mockito.Mockito;
16 | import org.springframework.beans.factory.annotation.Autowired;
17 | import org.springframework.http.HttpStatus;
18 | import org.springframework.http.ResponseEntity;
19 |
20 | import java.time.LocalDate;
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | import static org.junit.jupiter.api.Assertions.assertEquals;
25 | import static org.junit.jupiter.api.Assertions.assertThrows;
26 | import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
27 |
28 | class CreateGroupControllerRESTTest extends AbstractTest {
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/controllerLayer/unitTests/CreatePersonTransactionControllerRESTTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.controllerLayer.unitTests;
2 |
3 | import com.finance.project.applicationLayer.applicationServices.personServices.CreatePersonTransactionService;
4 | import com.finance.project.controllerLayer.controllersREST.personControllers.CreatePersonTransactionControllerREST;
5 | import com.finance.project.controllerLayer.integrationTests.AbstractTest;
6 | import com.finance.project.domainLayer.exceptions.NotFoundArgumentsBusinessException;
7 | import com.finance.project.dtos.dtosAssemblers.CreatePersonTransactionDTOAssembler;
8 | import org.junit.jupiter.api.DisplayName;
9 | import org.junit.jupiter.api.Test;
10 | import org.mockito.Mock;
11 | import org.mockito.Mockito;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import com.finance.project.dtos.dtos.CreatePersonTransactionDTO;
14 | import com.finance.project.dtos.dtos.NewPersonTransactionInfoDTO;
15 |
16 | import static org.junit.jupiter.api.Assertions.assertEquals;
17 | import static org.junit.jupiter.api.Assertions.assertThrows;
18 |
19 | class CreatePersonTransactionControllerRESTTest extends AbstractTest {
20 |
21 | @Mock
22 | private CreatePersonTransactionService service;
23 | @Autowired
24 | private CreatePersonTransactionControllerREST controller;
25 |
26 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/controllerLayer/unitTests/GroupSearchAccountRecordsControllerRESTTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.controllerLayer.unitTests;
2 |
3 | public class GroupSearchAccountRecordsControllerRESTTest {
4 | }
5 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/controllerLayer/unitTests/PersonSearchAccountRecordsControllerRESTTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.controllerLayer.unitTests;
2 |
3 | import com.finance.project.applicationLayer.applicationServices.personServices.PersonSearchAccountRecordsService;
4 | import com.finance.project.controllerLayer.controllersREST.personControllers.PersonSearchAccountRecordsControllerREST;
5 | import com.finance.project.controllerLayer.integrationTests.AbstractTest;
6 | import org.mockito.Mock;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 |
9 | import static org.junit.jupiter.api.Assertions.assertEquals;
10 |
11 | class PersonSearchAccountRecordsControllerRESTTest extends AbstractTest {
12 |
13 | @Mock
14 | private PersonSearchAccountRecordsService personSearchAccountRecordsService;
15 |
16 | @Autowired
17 | private PersonSearchAccountRecordsControllerREST personSearchAccountRecordsControllerREST;
18 |
19 |
20 |
21 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/domainLayer/repositoriesInterfaces/repositories_Interfaces_here.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/backend/src/test/java/com/finance/project/domainLayer/repositoriesInterfaces/repositories_Interfaces_here.txt
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/AccountDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.AccountDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.*;
8 |
9 | class AccountDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("AccountDTOAssembler - Test create AccountDTODTO from Primitive Types")
13 | void AccountDTOAssembler_createDTOFromPrimitiveTypes() {
14 |
15 | //Arrange
16 |
17 | String companyDenomination = "Company";
18 | String companyDescription = "Company account";
19 |
20 | //Arrange
21 | AccountDTOAssembler accountDTOAssembler = new AccountDTOAssembler();
22 | AccountDTO accountDTO = accountDTOAssembler.createDTOFromPrimitiveTypes(companyDenomination, companyDescription);
23 |
24 | //Expected
25 | AccountDTO accountDTOExpected = new AccountDTO(companyDenomination, companyDescription);
26 |
27 | //Assert
28 | assertEquals(accountDTOExpected, accountDTO);
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/AccountsDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.AccountDTO;
6 | import com.finance.project.dtos.dtos.AccountsDTO;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import static org.junit.jupiter.api.Assertions.assertEquals;
12 |
13 | class AccountsDTOAssemblerTest {
14 |
15 | @Test
16 | @DisplayName("AccountsDTOAssembler - Test create AccountsDTO from domain objects")
17 | void accountsDTOAssembler_createDTOFromDomainObject() {
18 |
19 | //Arrange
20 |
21 | String accountDenomination = "Supermarket Account";
22 | String accountDescription = "Supermarket expenses";
23 |
24 | AccountDTO accountDTO = AccountDTOAssembler.createDTOFromPrimitiveTypes(accountDenomination, accountDescription);
25 |
26 | List listAccountDTO = new ArrayList<>();
27 | listAccountDTO.add(accountDTO);
28 |
29 | //Act
30 | AccountsDTOAssembler accountsDTOAssembler = new AccountsDTOAssembler();
31 | AccountsDTO accountsDTO = accountsDTOAssembler.createDTOFromDomainObject(listAccountDTO);
32 |
33 | //Expected
34 | AccountsDTO accountsDTOExpected = new AccountsDTO(listAccountDTO);
35 |
36 | //Assert
37 | assertEquals(accountsDTOExpected, accountsDTO);
38 | }
39 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/AddPersonToGroupDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.AddPersonToGroupDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | /**
10 | * @Elisabete_Cavaleiro
11 | */
12 |
13 | class AddPersonToGroupDTOAssemblerTest {
14 |
15 | @Test
16 | @DisplayName("Test For createDataTransferObject_Primitives_addPersonToGroup()")
17 | void createDataTransferObject_Primitives() {
18 |
19 | // Arrange
20 |
21 | String personEmail = "cavaleiro@gmail.com";
22 | String groupDenomination = "Dance";
23 |
24 | AddPersonToGroupDTO expectedAddPersonToGroupDTO = new AddPersonToGroupDTO(personEmail, groupDenomination);
25 |
26 | // Act
27 | AddPersonToGroupDTOAssembler addPersonToGroupDTOAssembler = new AddPersonToGroupDTOAssembler();
28 | AddPersonToGroupDTO addPersonToGroupDTO = addPersonToGroupDTOAssembler.createDataTransferObject_Primitives(personEmail, groupDenomination);
29 |
30 | // Assert
31 |
32 | assertEquals(expectedAddPersonToGroupDTO, addPersonToGroupDTO);
33 | assertEquals(personEmail, addPersonToGroupDTO.getEmail());
34 | assertEquals(groupDenomination, addPersonToGroupDTO.getDenomination());
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/BooleanDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.BooleanDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | class BooleanDTOAssemblerTest {
10 |
11 |
12 | @Test
13 | @DisplayName("Test For createDataTransferObject_DomainObjects()")
14 | void createDataTransferObject_DomainObjects() {
15 |
16 | // Arrange
17 |
18 | boolean result = true;
19 | String msg = "Sucess";
20 |
21 |
22 | BooleanDTO expectedBooleanDTO = new BooleanDTO(result, msg);
23 |
24 | // Act
25 |
26 | BooleanDTOAssembler booleanDTOAssembler = new BooleanDTOAssembler();
27 | BooleanDTO booleanDTO = booleanDTOAssembler.createDTOFromPrimitiveTypes(result, msg);
28 |
29 | // Assert
30 |
31 | assertEquals(expectedBooleanDTO, booleanDTO);
32 | assertEquals(result, booleanDTO.getResult());
33 | assertEquals(msg, booleanDTO.getMsg());
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CategoriesDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.vosShared.CategoryID;
4 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
5 | import com.finance.project.domainLayer.entitiesInterfaces.OwnerID;
6 | import org.junit.jupiter.api.DisplayName;
7 | import org.junit.jupiter.api.Test;
8 | import com.finance.project.dtos.dtos.CategoriesDTO;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | import static org.junit.jupiter.api.Assertions.assertEquals;
14 |
15 | class CategoriesDTOAssemblerTest {
16 |
17 | @Test
18 | @DisplayName("CategoriesDTOAssembler - Test create categoriesDTO from domain objects")
19 | void categoriesDTOAssembler_createDTOFromDomainObject() {
20 |
21 | //Arrange
22 | String emailMaria = "maria@gmail.com";
23 |
24 | OwnerID ownerID = PersonID.createPersonID(emailMaria);
25 |
26 | String categoriesDenomination = "Food";
27 |
28 | CategoryID categoryID = CategoryID.createCategoryID(categoriesDenomination, ownerID);
29 |
30 | List categoryIDS = new ArrayList<>();
31 | categoryIDS.add(categoryID);
32 |
33 | //Act
34 | CategoriesDTOAssembler categoriesDTOAssembler = new CategoriesDTOAssembler();
35 | CategoriesDTO categoriesDTO = categoriesDTOAssembler.createDTOFromDomainObject(categoryIDS);
36 |
37 | //Expected
38 | List categories = new ArrayList<>();
39 | categories.add(categoriesDenomination);
40 | CategoriesDTO categoriesDTOExpected = new CategoriesDTO(categories);
41 |
42 | //Assert
43 | assertEquals(categoriesDTOExpected, categoriesDTO);
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CreateGroupAccountDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.CreateGroupAccountDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | public class CreateGroupAccountDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Test For creating Data Transfer Objects - Primitives | Happy case")
13 | void createDTO_Primitives() {
14 |
15 | // Arrange
16 | String personEmail = "lebron@gmail.com";
17 | String groupDenomination = "Lakers";
18 | String accountDescription = "Lakers Expenses";
19 | String accountDenomination = "LakersAccount";
20 |
21 | CreateGroupAccountDTO expectedCreateGroupAccountDTO = new CreateGroupAccountDTO(personEmail, groupDenomination, accountDescription, accountDenomination);
22 |
23 | // Act
24 | CreateGroupAccountDTO createGroupAccountDTO = CreateGroupAccountDTOAssembler.createDTOFromPrimitiveTypes(personEmail, groupDenomination, accountDescription, accountDenomination);
25 |
26 | // Assert
27 | assertEquals(expectedCreateGroupAccountDTO, createGroupAccountDTO);
28 | assertEquals(personEmail, createGroupAccountDTO.getPersonEmail());
29 | assertEquals(groupDenomination, createGroupAccountDTO.getGroupDenomination());
30 | assertEquals(accountDescription, createGroupAccountDTO.getAccountDescription());
31 | assertEquals(accountDenomination, createGroupAccountDTO.getAccountDenomination());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CreateGroupCategoryDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.CreateGroupCategoryDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | class CreateGroupCategoryDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Test For createDataTransferObject_Primitives()")
13 | void createDataTransferObject_Primitives() {
14 |
15 | // Arrange
16 |
17 | String personEmail = "paulo@gmail.com";
18 | String groupDenomination = "Runners";
19 | String categoryDenomination = "Equipment";
20 |
21 | CreateGroupCategoryDTO expectedCreateGroupCategoryDTO = new CreateGroupCategoryDTO(personEmail, groupDenomination, categoryDenomination);
22 |
23 | // Act
24 |
25 | CreateGroupCategoryDTOAssembler createGroupCategoryDTOAssembler = new CreateGroupCategoryDTOAssembler();
26 | CreateGroupCategoryDTO createGroupCategoryDTO = createGroupCategoryDTOAssembler.createDTOFromPrimitiveTypes(personEmail, groupDenomination, categoryDenomination);
27 |
28 | // Assert
29 |
30 | assertEquals(expectedCreateGroupCategoryDTO, createGroupCategoryDTO);
31 | assertEquals(personEmail, createGroupCategoryDTO.getPersonEmail());
32 | assertEquals(groupDenomination, createGroupCategoryDTO.getGroupDenomination());
33 | assertEquals(categoryDenomination, createGroupCategoryDTO.getCategoryDenomination());
34 | }
35 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CreateGroupDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.CreateGroupDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | class CreateGroupDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Test create Data Transfer Object with Primitives || Happy case")
13 | void testCreateDataTransferObjectWithPrimitives(){
14 |
15 | //Arrange
16 | String email = "maria@gmail.com";
17 | String denomination = "Friends";
18 | String description = "Old friends from school";
19 |
20 | //Expected
21 | CreateGroupDTO createGroupDTOExpected = new CreateGroupDTO(email, denomination, description);
22 |
23 | //Act
24 | CreateGroupDTOAssembler createGroupDTOAssembler = new CreateGroupDTOAssembler();
25 | CreateGroupDTO createGroupDTO = createGroupDTOAssembler.createDTOFromPrimitiveTypes(email, denomination, description);
26 |
27 | //Assert
28 | assertEquals(createGroupDTOExpected, createGroupDTO);
29 | assertEquals(email, createGroupDTO.getEmail());
30 | assertEquals(denomination, createGroupDTO.getDenomination());
31 | assertEquals(description, createGroupDTO.getDescription());
32 | }
33 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CreatePersonAccountDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.CreatePersonAccountDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | public class CreatePersonAccountDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Create DTO primitive type")
13 | void createDTO() {
14 |
15 | // Arrange
16 | String email = "santi@gmail.com";
17 | String denomination = "Tennis";
18 | String description = "Roland Garros 2020 tickets";
19 |
20 | CreatePersonAccountDTO expected = new CreatePersonAccountDTO(email, description, denomination);
21 |
22 | // Act
23 |
24 | CreatePersonAccountDTOAssembler createPersonAccountDTOAssembler = new CreatePersonAccountDTOAssembler();
25 | CreatePersonAccountDTO createPersonAccountDTO = createPersonAccountDTOAssembler.createDTOFromPrimitiveTypes(email, description, denomination);
26 |
27 | // Assert
28 | assertEquals(expected, createPersonAccountDTO);
29 | assertEquals(email, createPersonAccountDTO.getEmail());
30 | assertEquals(denomination, createPersonAccountDTO.getDenomination());
31 | assertEquals(description, createPersonAccountDTO.getDescription());
32 | }
33 |
34 |
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CreatePersonCategoryDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.CreatePersonCategoryDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | class CreatePersonCategoryDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Create DTO primitive type")
13 | void createDTO() {
14 |
15 | // Arrange
16 | String email = "lebron@gmail.com";
17 | String denomination = "Basket";
18 |
19 | CreatePersonCategoryDTO expected = new CreatePersonCategoryDTO(email, denomination);
20 |
21 | // Act
22 |
23 | CreatePersonCategoryDTOAssembler createPersonCategoryDTOAssembler = new CreatePersonCategoryDTOAssembler();
24 | CreatePersonCategoryDTO createPersonCategoryDTO = createPersonCategoryDTOAssembler.createDTOFromPrimitiveTypes(email, denomination);
25 |
26 | // Assert
27 | assertEquals(expected, createPersonCategoryDTO);
28 | assertEquals(email, createPersonCategoryDTO.getEmail());
29 | assertEquals(denomination, createPersonCategoryDTO.getDenomination());
30 | }
31 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CreatePersonDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.CreatePersonDTO;
6 |
7 | import java.time.LocalDate;
8 |
9 | import static org.junit.jupiter.api.Assertions.assertEquals;
10 |
11 | class CreatePersonDTOAssemblerTest {
12 |
13 | @Test
14 | @DisplayName("CreatePersonDTOAssembler - Test create Data Transfer Object with Primitives || Happy case")
15 | void createPersonDTOAssembler_CreateDataTransferObjectWithPrimitivesTest() {
16 |
17 | //Arrange
18 | String mariaEmail = "maria@gmail.com";
19 | String mariaName = "Maria Silva";
20 | LocalDate mariaBirthdate = LocalDate.of(1973, 07, 25);
21 | String mariaBirthdateString = "1973-07-25";
22 |
23 | String mariaBirthplace = "Braga";
24 |
25 | //Expected
26 |
27 | CreatePersonDTO createPersonDTOExpected = new CreatePersonDTO(mariaEmail, mariaName, mariaBirthdate, mariaBirthplace);
28 |
29 | //Act
30 | CreatePersonDTOAssembler createPersonDTOAssembler = new CreatePersonDTOAssembler();
31 | CreatePersonDTO createPersonDTO = createPersonDTOAssembler.createDTOFromPrimitiveTypes(mariaEmail, mariaName, mariaBirthdateString, mariaBirthplace);
32 |
33 | //Assert
34 | assertEquals(createPersonDTOExpected, createPersonDTO);
35 | assertEquals(mariaEmail, createPersonDTO.getEmail());
36 | assertEquals(mariaName, createPersonDTO.getName());
37 | assertEquals(mariaBirthdate, createPersonDTO.getBirthdate());
38 | assertEquals(mariaBirthplace, createPersonDTO.getBirthplace());
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/CreatePersonTransactionDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.CreatePersonTransactionDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | class CreatePersonTransactionDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Test For createDataTransferObject_Primitives()")
13 | void createDTOFromPrimitiveTypes() {
14 |
15 | // Arrange
16 |
17 | String email = "paulo@gmail.com";
18 | String denominationCategory = "HairStylist";
19 | String type = "debit";
20 | String description = "Pente0";
21 | double amount = 150.0;
22 | String denominationAccountDeb = "DebitAccountJon";
23 | String denominationAccountCred = "CredditAccountJon";
24 | String date = "2020-03-05";
25 |
26 | CreatePersonTransactionDTO expected_CreatePersonTransactionDTO = new CreatePersonTransactionDTO(email, denominationCategory, type, description, amount, denominationAccountDeb, denominationAccountCred, date);
27 |
28 | // Act
29 |
30 | CreatePersonTransactionDTO createPersonTransactionDTO = CreatePersonTransactionDTOAssembler.createDTOFromPrimitiveTypes(email, denominationCategory, type, description, amount, denominationAccountDeb, denominationAccountCred, date);
31 |
32 | // Assert
33 |
34 | assertEquals(expected_CreatePersonTransactionDTO, createPersonTransactionDTO);
35 | assertEquals(email, createPersonTransactionDTO.getEmail());
36 | assertEquals(denominationCategory, createPersonTransactionDTO.getDenominationCategory());
37 | assertEquals(type, createPersonTransactionDTO.getType());
38 | assertEquals(description, createPersonTransactionDTO.getDescription());
39 | assertEquals(amount, createPersonTransactionDTO.getAmount());
40 | assertEquals(denominationAccountDeb, createPersonTransactionDTO.getDenominationAccountDeb());
41 | assertEquals(denominationAccountCred, createPersonTransactionDTO.getDenominationAccountCred());
42 |
43 | }
44 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/DeletePersonTransactionDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.DeletePersonTransactionDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.*;
8 |
9 | class DeletePersonTransactionDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Test For createDataTransferObject_Primitives()")
13 | void createDataTransferObject_Primitives() {
14 |
15 | //Arrange
16 |
17 | int transactionNumber = 3;
18 | String email = "francisco@gmail.com";
19 |
20 | DeletePersonTransactionDTO expectedDeletePersonTransactionDTO = new DeletePersonTransactionDTO(transactionNumber, email);
21 |
22 | //Act
23 |
24 | DeletePersonTransactionDTO deletePersonTransactionDTO = DeletePersonTransactionDTOAssembler.createDTOFromPrimitiveTypes(transactionNumber, email);
25 |
26 | //Arrange
27 |
28 | assertEquals(expectedDeletePersonTransactionDTO, deletePersonTransactionDTO);
29 | assertEquals(transactionNumber, deletePersonTransactionDTO.getTransactionNumber());
30 | assertEquals(email, deletePersonTransactionDTO.getEmail());
31 |
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/GroupAdminsDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
4 | import org.junit.jupiter.api.DisplayName;
5 | import org.junit.jupiter.api.Test;
6 | import com.finance.project.dtos.dtos.GroupAdminsDTO;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import static org.junit.jupiter.api.Assertions.assertEquals;
12 |
13 | class GroupAdminsDTOAssemblerTest {
14 |
15 | @Test
16 | @DisplayName("GroupAdminsDTOAssembler - Test create GroupMembersDTO from domain objects")
17 | void GroupAdminsDTOAssembler_createDTOFromDomainObject() {
18 |
19 | //Arrange
20 | String emailMaria = "maria@gmail.com";
21 | PersonID idMaria = PersonID.createPersonID(emailMaria);
22 |
23 | List personIDs = new ArrayList<>();
24 | personIDs.add(idMaria);
25 |
26 | //Arrange
27 | GroupAdminsDTOAssembler groupAdminsDTOAssembler = new GroupAdminsDTOAssembler();
28 | GroupAdminsDTO groupAdminsDTO = groupAdminsDTOAssembler.createDTOFromDomainObject(personIDs);
29 |
30 | //Expected
31 | List persons = new ArrayList<>();
32 | persons.add(emailMaria);
33 | GroupAdminsDTO groupMembersDTOExpected = new GroupAdminsDTO(persons);
34 |
35 | //Assert
36 | assertEquals(groupMembersDTOExpected, groupAdminsDTO);
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/GroupIDDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.vosShared.GroupID;
4 | import org.junit.jupiter.api.DisplayName;
5 | import org.junit.jupiter.api.Test;
6 | import com.finance.project.dtos.dtos.GroupIDDTO;
7 |
8 | import static org.junit.jupiter.api.Assertions.assertEquals;
9 |
10 | class GroupIDDTOAssemblerTest {
11 |
12 | @Test
13 | @DisplayName("Test create Data Transfer Object with Primitives - GroupID || Happy case")
14 | void testCreateDataTransferObjectWithPrimitives() {
15 |
16 | String denomination = "Dance";
17 | GroupID groupID = GroupID.createGroupID(denomination);
18 |
19 |
20 | GroupIDDTO createGroupIDTOExpected = new GroupIDDTO(denomination);
21 |
22 | GroupIDDTOAssembler groupIDDTOAssembler = new GroupIDDTOAssembler();
23 |
24 | GroupIDDTO groupIDDTO = groupIDDTOAssembler.createDTOFromDomainObject(groupID);
25 |
26 | assertEquals(createGroupIDTOExpected, groupIDDTO);
27 |
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/GroupMembersDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
4 | import org.junit.jupiter.api.DisplayName;
5 | import org.junit.jupiter.api.Test;
6 | import com.finance.project.dtos.dtos.GroupMembersDTO;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import static org.junit.jupiter.api.Assertions.assertEquals;
12 |
13 | class GroupMembersDTOAssemblerTest {
14 |
15 | @Test
16 | @DisplayName("GroupMembersDTOAssembler - Test create GroupMembersDTO from domain objects")
17 | void groupMembersDTOAssembler_createDTOFromDomainObject() {
18 |
19 | //Arrange
20 | String emailMaria = "maria@gmail.com";
21 | PersonID idMaria = PersonID.createPersonID(emailMaria);
22 |
23 | List personIDs = new ArrayList<>();
24 | personIDs.add(idMaria);
25 |
26 | //Arrange
27 | GroupMembersDTOAssembler groupMembersDTOAssembler = new GroupMembersDTOAssembler();
28 | GroupMembersDTO groupMembersDTO = groupMembersDTOAssembler.createDTOFromDomainObject(personIDs);
29 |
30 | //Expected
31 | List persons = new ArrayList<>();
32 | persons.add(emailMaria);
33 | GroupMembersDTO groupMembersDTOExpected = new GroupMembersDTO(persons);
34 |
35 | //Assert
36 | assertEquals(groupMembersDTOExpected, groupMembersDTO);
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/GroupSearchAccountRecordsInDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.GroupSearchAccountRecordsInDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.*;
8 |
9 | class GroupSearchAccountRecordsInDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Test DTO assembler constructor")
13 | void constructorTest() {
14 |
15 | //Arrange
16 | String personEmail = "paulo@gmail.com";
17 | String groupDenomination = "Fontes Family";
18 | String accountDenomination = "Bank Account";
19 | String startDate = "2020-01-21";
20 | String endDate = "2020-01-29";
21 |
22 | GroupSearchAccountRecordsInDTO expectedDTO = new GroupSearchAccountRecordsInDTO(personEmail, groupDenomination, accountDenomination, startDate, endDate);
23 |
24 | //Act
25 | GroupSearchAccountRecordsInDTO resultAssemblerDTO = GroupSearchAccountRecordsInDTOAssembler.groupSearchAccountRecordsInDTO(personEmail, groupDenomination, accountDenomination, startDate, endDate);
26 |
27 | //Assert
28 | assertEquals(expectedDTO, resultAssemblerDTO);
29 | assertEquals(personEmail, resultAssemblerDTO.getPersonEmail());
30 | assertEquals(groupDenomination, resultAssemblerDTO.getGroupDenomination());
31 | assertEquals(accountDenomination, resultAssemblerDTO.getAccountDenomination());
32 | assertEquals(startDate, resultAssemblerDTO.getStartDate());
33 | assertEquals(endDate, resultAssemblerDTO.getEndDate());
34 |
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/GroupTransactionsWithinPeriodDTOinAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.GroupTransactionsWithinPeriodDTOin;
6 |
7 | import java.time.LocalDate;
8 |
9 | import static org.junit.jupiter.api.Assertions.assertEquals;
10 |
11 | class GroupTransactionsWithinPeriodDTOinAssemblerTest {
12 | @Test
13 | @DisplayName("Test DTO Constructor")
14 | void constructorTest() {
15 | //Arrange
16 | String personEmail = "paulo@gmail.com";
17 | String groupDenomination = "House";
18 | LocalDate startDate = LocalDate.of(2020, 01, 05);
19 | LocalDate endDate = LocalDate.of(2020, 02, 10);
20 | GroupTransactionsWithinPeriodDTOin expectedGroupTransactionsWithinPeriodDTOin = new GroupTransactionsWithinPeriodDTOin(personEmail, groupDenomination, startDate, endDate);
21 |
22 | //Act
23 | GroupTransactionsWithinPeriodDTOinAssembler groupTransactionsWithinPeriodDTOinAssembler = new GroupTransactionsWithinPeriodDTOinAssembler();
24 | GroupTransactionsWithinPeriodDTOin assemblerDTOin = groupTransactionsWithinPeriodDTOinAssembler.createGroupTransactionsWithinPeriodDTOin(personEmail, groupDenomination, startDate, endDate);
25 |
26 | //Assert
27 | assertEquals(expectedGroupTransactionsWithinPeriodDTOin, assemblerDTOin);
28 | assertEquals(groupDenomination, assemblerDTOin.getGroupDenomination());
29 | assertEquals(startDate, assemblerDTOin.getStartDate());
30 | assertEquals(endDate, assemblerDTOin.getEndDate());
31 | }
32 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/GroupsThatAreFamilyDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.GroupIDDTO;
6 | import com.finance.project.dtos.dtos.GroupsThatAreFamilyDTO;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import static org.junit.jupiter.api.Assertions.assertEquals;
12 |
13 |
14 | class GroupsThatAreFamilyDTOAssemblerTest {
15 |
16 | @Test
17 | @DisplayName("Test create Data Transfer Object with Domain Objects || Happy case")
18 | void testCreateDataTransferObjectWithDomainObjects(){
19 |
20 | //Arrange
21 |
22 | List families = new ArrayList<>();
23 |
24 | //Act
25 |
26 | GroupsThatAreFamilyDTOAssembler groupsThatAreFamilyDTOAssembler = new GroupsThatAreFamilyDTOAssembler();
27 | GroupsThatAreFamilyDTO groupsThatAreFamilyDTO = groupsThatAreFamilyDTOAssembler.createDTOFromDomainObject(families);
28 |
29 | //Assert
30 |
31 | assertEquals(families, groupsThatAreFamilyDTO.getGroupThatAreFamily());
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/PersonSearchAccountRecordsInDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import org.junit.jupiter.api.DisplayName;
4 | import org.junit.jupiter.api.Test;
5 | import com.finance.project.dtos.dtos.PersonSearchAccountRecordsInDTO;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 |
9 | class PersonSearchAccountRecordsInDTOAssemblerTest {
10 |
11 | @Test
12 | @DisplayName("Test DTO Constructor")
13 | void constructorTest() {
14 |
15 | // Arrange
16 | String personEmail = "paulo@gmail.com";
17 | String denominationAccount = "EDP";
18 | String startDate = "2020-01-05";
19 | String endDate = "2020-02-10";
20 |
21 | PersonSearchAccountRecordsInDTO expectedPersonAccountTransactionsWihtinPeriodDTOin = new PersonSearchAccountRecordsInDTO(personEmail, denominationAccount, startDate, endDate);
22 |
23 | // Act
24 | PersonSearchAccountRecordsInDTO assemblerDTOin = PersonSearchAccountRecordsInDTOAssembler.personAccountTransactionsInDTO(personEmail, denominationAccount, startDate, endDate);
25 |
26 | // Assert
27 | assertEquals(expectedPersonAccountTransactionsWihtinPeriodDTOin, assemblerDTOin);
28 | assertEquals(personEmail, assemblerDTOin.getPersonEmail());
29 | assertEquals(denominationAccount, assemblerDTOin.getAccountDenomination());
30 | assertEquals(startDate, assemblerDTOin.getStartDate());
31 | assertEquals(endDate, assemblerDTOin.getEndDate());
32 | }
33 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/dtos/dtosAssemblers/SiblingsDTOAssemblerTest.java:
--------------------------------------------------------------------------------
1 | package com.finance.project.dtos.dtosAssemblers;
2 |
3 | import com.finance.project.domainLayer.domainEntities.vosShared.PersonID;
4 | import org.junit.jupiter.api.DisplayName;
5 | import org.junit.jupiter.api.Test;
6 | import com.finance.project.dtos.dtos.SiblingsDTO;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import static org.junit.jupiter.api.Assertions.assertEquals;
12 |
13 | class SiblingsDTOAssemblerTest {
14 |
15 | @Test
16 | @DisplayName("SiblingsDTOssembler - Test create data transfer objects from Domain Object || Happy case")
17 | void siblingsDTOAssembler_CreateDTOFromDomainObjectTest() {
18 |
19 | //Arrange
20 | String emailRui = "rui@gmail.com";
21 | PersonID idRui = PersonID.createPersonID(emailRui);
22 | String emailhenrique = "henrique@gmail.com";
23 | PersonID idHenrique = PersonID.createPersonID(emailhenrique);
24 |
25 | List personIDs = new ArrayList<>();
26 | personIDs.add(idRui);
27 | personIDs.add(idHenrique);
28 |
29 | //Arrange
30 | SiblingsDTOAssembler siblingsDTOAssembler = new SiblingsDTOAssembler();
31 | SiblingsDTO groupMembersDTO = siblingsDTOAssembler.createDTOFromDomainObject(personIDs);
32 |
33 | //Expected
34 | List persons = new ArrayList<>();
35 | persons.add(emailRui);
36 | persons.add(emailhenrique);
37 |
38 | SiblingsDTO groupMembersDTOExpected = new SiblingsDTO(persons);
39 |
40 | //Assert
41 | assertEquals(groupMembersDTOExpected, groupMembersDTO);
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/backend/src/test/java/com/finance/project/infrastructureLayer/infrastructureLayer_here.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/backend/src/test/java/com/finance/project/infrastructureLayer/infrastructureLayer_here.txt
--------------------------------------------------------------------------------
/diagrams/CD_add_Account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/CD_add_Account.png
--------------------------------------------------------------------------------
/diagrams/DDD.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/DDD.png
--------------------------------------------------------------------------------
/diagrams/DM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/DM.png
--------------------------------------------------------------------------------
/diagrams/FURPS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/FURPS.png
--------------------------------------------------------------------------------
/diagrams/GOF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/GOF.png
--------------------------------------------------------------------------------
/diagrams/GRASP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/GRASP.png
--------------------------------------------------------------------------------
/diagrams/SDP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/SDP.png
--------------------------------------------------------------------------------
/diagrams/SD_add_Account_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/SD_add_Account_1.png
--------------------------------------------------------------------------------
/diagrams/SD_add_Account_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/SD_add_Account_2.png
--------------------------------------------------------------------------------
/diagrams/SD_add_Account_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/SD_add_Account_3.png
--------------------------------------------------------------------------------
/diagrams/SOLID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/SOLID.png
--------------------------------------------------------------------------------
/diagrams/STUPID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/STUPID.png
--------------------------------------------------------------------------------
/diagrams/analysis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/analysis.png
--------------------------------------------------------------------------------
/diagrams/arch_styles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/arch_styles.png
--------------------------------------------------------------------------------
/diagrams/architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/architecture.png
--------------------------------------------------------------------------------
/diagrams/both.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/both.png
--------------------------------------------------------------------------------
/diagrams/c4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/c4.png
--------------------------------------------------------------------------------
/diagrams/categories.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/categories.png
--------------------------------------------------------------------------------
/diagrams/combined.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/combined.jpeg
--------------------------------------------------------------------------------
/diagrams/ddd_concepts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/ddd_concepts.png
--------------------------------------------------------------------------------
/diagrams/earlyEarlySD.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/earlyEarlySD.png
--------------------------------------------------------------------------------
/diagrams/earlySD.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/earlySD.png
--------------------------------------------------------------------------------
/diagrams/groupsH2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/groupsH2.png
--------------------------------------------------------------------------------
/diagrams/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/home.png
--------------------------------------------------------------------------------
/diagrams/layers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/layers.png
--------------------------------------------------------------------------------
/diagrams/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/login.png
--------------------------------------------------------------------------------
/diagrams/personsH2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/personsH2.png
--------------------------------------------------------------------------------
/diagrams/uml/aggregation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/uml/aggregation.png
--------------------------------------------------------------------------------
/diagrams/uml/association.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/uml/association.png
--------------------------------------------------------------------------------
/diagrams/uml/composition.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/uml/composition.png
--------------------------------------------------------------------------------
/diagrams/uml/dependency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/uml/dependency.png
--------------------------------------------------------------------------------
/diagrams/uml/encapsulation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/uml/encapsulation.png
--------------------------------------------------------------------------------
/diagrams/uml/inheritance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/uml/inheritance.png
--------------------------------------------------------------------------------
/diagrams/uml/polymorphism.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/uml/polymorphism.png
--------------------------------------------------------------------------------
/diagrams/viewModel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/diagrams/viewModel.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "finalapp",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.3.2",
8 | "@testing-library/user-event": "^7.1.2",
9 | "bootstrap": "^4.5.0",
10 | "npm": "^6.14.5",
11 | "react": "^16.13.1",
12 | "react-bootstrap": "^1.0.1",
13 | "react-dom": "^16.13.1",
14 | "react-router-dom": "^5.2.0",
15 | "react-scripts": "3.4.1",
16 | "start": "^5.1.0"
17 | },
18 | "scripts": {
19 | "start": "react-scripts start",
20 | "build": "react-scripts build",
21 | "test": "react-scripts test",
22 | "eject": "react-scripts eject"
23 | },
24 | "eslintConfig": {
25 | "extends": "react-app"
26 | },
27 | "browserslist": {
28 | "production": [
29 | ">0.2%",
30 | "not dead",
31 | "not op_mini all"
32 | ],
33 | "development": [
34 | "last 1 chrome version",
35 | "last 1 firefox version",
36 | "last 1 safari version"
37 | ]
38 | },
39 | "devDependencies": {
40 | "axios": "^0.19.2",
41 | "prop-types": "^15.7.2"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/public/favicon.ico
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intldds/ddd-domain-driven-design/dd3b0ecb23f876297a48f71a0fca1dd3a3266ba8/public/logo512.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render();
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/src/context/AppContext.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const AppContext = React.createContext();
4 | export const {Provider} = AppContext;
5 | export default AppContext;
--------------------------------------------------------------------------------
/src/entities/categories/CategoryForm.js:
--------------------------------------------------------------------------------
1 | import React, {useContext, useState} from "react";
2 | import axios from 'axios';
3 | import AppContext from "../../context/AppContext";
4 | import {Api, updateCategories} from "../../context/Actions";
5 | import Button from "react-bootstrap/Button";
6 |
7 | const CategoryForm = (props) => {
8 |
9 | const {state, dispatch} = useContext(AppContext)
10 |
11 | const {userID, categories, myPage, myGroups} = state;
12 | const [denomination, setDenomination] = useState('');
13 |
14 | const handleClick = async (event) => {
15 | const user = userID.toLowerCase();
16 |
17 | event.preventDefault();
18 |
19 | if (myPage && !myGroups) {
20 |
21 | try {
22 | await Api.post('/persons/' + user + '/categories/', {
23 | denomination: denomination
24 | });
25 |
26 | dispatch(updateCategories([...categories.categoriesData, denomination]));
27 |
28 | } catch (err) {
29 | alert(err.response.data.message);
30 | }
31 | }
32 |
33 | if (!myPage && myGroups) {
34 |
35 | try {
36 | await axios.post(props.url, {categoryDenomination: denomination});
37 |
38 | dispatch(updateCategories([...categories.categoriesData, denomination]));
39 |
40 | } catch (err) {
41 | alert(err.response.data.message);
42 | }
43 | }
44 | setDenomination('');
45 | }
46 |
47 | return (
48 |
49 |
57 |
58 | );
59 | };
60 |
61 | export default CategoryForm;
--------------------------------------------------------------------------------
/src/entities/categories/GroupCategories.js:
--------------------------------------------------------------------------------
1 | import React, {useContext} from 'react';
2 | import AppContext from '../../context/AppContext';
3 |
4 | function GroupCategories() {
5 | const {state} = useContext(AppContext);
6 | const {groups, categoriesData, accountsData, transactions} = state;
7 | const {transactionsData} = transactions;
8 | const {isLoading, error, groupsData} = groups;
9 | // if (isLoading === true) {
10 | // return (Loading ....
);
11 | // }
12 | // else {
13 | // if (error !== null) {
14 | // return (Error ....
);
15 | // } else
16 | if (categoriesData.length > 0) {
17 | return (
18 |
19 |
20 |
21 | {categoriesData.map((category) => (
22 | - {category}
23 | ))}
24 |
25 |
26 |
27 | );
28 | } else {
29 | return (No data ....
);
30 | }
31 |
32 | }
33 |
34 | export default GroupCategories;
--------------------------------------------------------------------------------
/src/entities/groups/EntityGroup.js:
--------------------------------------------------------------------------------
1 | import React, {useContext, useEffect} from "react";
2 | import axios from 'axios';
3 | import AppContext from "../../context/AppContext";
4 | import {fetch_group_started, fetch_group_success, fetch_group_error} from "../../context/Actions";
5 | import GroupsTable from "../../tables/GroupsTable/GroupsTable";
6 | import GroupForm from "./GroupForm";
7 | import MyPage from "../../links/Mypage";
8 | import User from "../../tables/User/User";
9 |
10 | function EntityGroup() {
11 |
12 | const {state, dispatch} = useContext(AppContext);
13 |
14 | const {isLogged, groups, userID, username} = state;
15 |
16 | const {isLoading, error, groupsData} = groups;
17 |
18 | useEffect(() => {
19 | if (isLogged == true) {
20 | getGroups();
21 | }
22 | }, [])
23 |
24 |
25 | // Get User Groups
26 |
27 | const getGroups = async () => {
28 |
29 | const user = userID.toLowerCase();
30 |
31 | const url = `http://localhost:8080/persons/${user}/groups`;
32 |
33 | dispatch(fetch_group_started());
34 |
35 | try {
36 | const res = await axios.get(url);
37 | const {data} = await res;
38 | dispatch(fetch_group_success(data.groups));
39 | } catch (err) {
40 | dispatch(fetch_group_error(err.message));
41 | }
42 | }
43 |
44 |
45 | // Conditional rendering
46 |
47 | const headers = {
48 | header1: 'Denomination',
49 | header2: 'Description',
50 | header3: 'Date of Creation'
51 | };
52 | let data;
53 |
54 | if (!isLogged) {
55 | return (Not logged
);
56 |
57 | }
58 |
59 | if (isLoading == true) {
60 | return (Loading...
);
61 | }
62 |
63 | if (error.length > 0) {
64 | return ({error}...
);
65 | } else {
66 | data =
67 | }
68 |
69 | return (
70 |
71 |
72 |
73 |
74 | {data}
75 |
76 |
77 | )
78 |
79 | }
80 |
81 | export default EntityGroup;
--------------------------------------------------------------------------------
/src/entities/groups/Members/EntityMembers.js:
--------------------------------------------------------------------------------
1 | import React, {useContext, useEffect} from "react";
2 | import AppContext from "../../../context/AppContext";
3 | import {Api, fetchMembersError, fetchMembersStarted, fetchMembersSuccess} from "../../../context/Actions";
4 | import MembersTable from "../../../tables/MembersTable/MembersTable";
5 | import MembersFrom from "./MembersForm";
6 | import GroupId from "../../../links/GroupId";
7 |
8 | function EntityMembers() {
9 |
10 | const {state, dispatch} = useContext(AppContext);
11 |
12 | const {isLogged, groupDenomination, members} = state;
13 |
14 | const {isLoading, error, membersData} = members;
15 |
16 |
17 | useEffect(() => {
18 | if (isLogged == true) {
19 | getAllMembers();
20 |
21 | }
22 | }, [])
23 |
24 | const getAllMembers = async () => {
25 |
26 | const url = '/groups/' + groupDenomination + '/allMembers';
27 |
28 | dispatch(fetchMembersStarted());
29 |
30 | try {
31 | const res = await Api.get(url);
32 | const {data} = res;
33 | dispatch(fetchMembersSuccess(data.allMembers));
34 | } catch (err) {
35 | dispatch(fetchMembersError(err.message));
36 | }
37 | };
38 |
39 |
40 | const headers = {
41 | header1: 'Members',
42 | header2: 'Clearance',
43 | };
44 |
45 | let data;
46 |
47 |
48 | if (!isLogged) {
49 | return (Not logged
)
50 | }
51 |
52 | if (isLoading) {
53 | return (Loading...
);
54 | }
55 |
56 | if (error.length > 0) {
57 | return ({error}...
);
58 | } else {
59 | data =
60 | }
61 |
62 | return (
63 |
64 |
65 |
66 | {data}
67 |
68 |
69 | )
70 |
71 | }
72 |
73 | export default EntityMembers;
--------------------------------------------------------------------------------
/src/entities/groups/Members/MembersForm.js:
--------------------------------------------------------------------------------
1 | import React, {useContext, useState} from "react";
2 | import AppContext from "../../../context/AppContext";
3 | import {Api, updateMembers} from "../../../context/Actions";
4 | import Button from "react-bootstrap/Button";
5 |
6 | const MembersFrom = () => {
7 |
8 | const {state, dispatch} = useContext(AppContext);
9 |
10 | const {groupDenomination, members} = state;
11 | const {membersData} = members;
12 |
13 | const [memberID, setMemberID] = useState('');
14 |
15 | // Clearance
16 |
17 | const [clearance, setClearance] = useState("member");
18 |
19 |
20 | const handleClick = (event) => {
21 |
22 | event.preventDefault();
23 |
24 | Api.post('/groups/' + groupDenomination + '/members', {
25 | email: memberID
26 | }).then(response => {
27 | dispatch(updateMembers([...membersData, {memberID, clearance}]));
28 | })
29 | .catch(err => alert(err.response.data.message));
30 | setMemberID('');
31 | }
32 |
33 | return (
34 |
35 |
41 |
42 | );
43 | }
44 |
45 | export default MembersFrom
--------------------------------------------------------------------------------
/src/entities/ledgers/LedgerGroup.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import EntityLedgers from "./EntityLedgers";
3 |
4 |
5 | function LedgerGroup (){
6 | return (
7 |
8 |
9 |
10 |
11 |
12 | )
13 | }
14 |
15 | export default LedgerGroup;
--------------------------------------------------------------------------------
/src/entities/members/Members.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from "react";
2 | import axios from 'axios';
3 | import Table from "../tables/Table";
4 |
5 | const api = axios.create({
6 | baseURL: 'http://localhost:8080/'
7 | })
8 |
9 | class Members extends Component {
10 | state = {
11 | members: []
12 | }
13 |
14 | constructor() {
15 | super();
16 | this.getAllMembers()
17 | }
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom'
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 | import AppProvider from './context/AppProvider';
7 |
8 | ReactDOM.render(
9 |
10 |
11 |
12 |
13 | ,
14 | document.getElementById('root')
15 | );
16 |
17 | // If you want your app to work offline and load faster, you can change
18 | // unregister() to register() below. Note this comes with some pitfalls.
19 | // Learn more about service workers: https://bit.ly/CRA-PWA
20 | serviceWorker.unregister();
21 |
--------------------------------------------------------------------------------
/src/links/Accounts.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import EntityAccount from '../entities/accounts/EntityAccount';
3 |
4 | function Accounts() {
5 |
6 | return (
7 |
8 |
9 |
10 | )
11 |
12 | }
13 |
14 | export default Accounts;
--------------------------------------------------------------------------------
/src/links/AdminsGroup.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 |
4 | function AdminsGroup (){
5 | return (
6 |
7 |
Group admins
8 |
9 |
Insert group admins table.
10 |
11 |
12 | )
13 | }
14 |
15 | export default AdminsGroup;
--------------------------------------------------------------------------------
/src/links/Categories.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import EntityCategory from "../entities/categories/EntityCategory";
3 |
4 |
5 | function Categories (){
6 | return (
7 |
8 |
9 |
10 | )
11 | }
12 |
13 | export default Categories;
--------------------------------------------------------------------------------
/src/links/Home.js:
--------------------------------------------------------------------------------
1 | import React, {useContext} from 'react';
2 | import AppContext from "../context/AppContext";
3 | import MyPage from "./Mypage";
4 |
5 | function Home() {
6 |
7 | const {state} = useContext(AppContext);
8 |
9 | const {isLogged} = state;
10 |
11 | if (isLogged === true) {
12 | return (
13 |
18 |
19 |
20 | );
21 | }
22 |
23 | }
24 |
25 | export default Home;
--------------------------------------------------------------------------------
/src/links/Ledger.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import EntityLedgers from "../entities/ledgers/EntityLedgers";
3 |
4 | function Ledger () {
5 | return(
6 |
7 |
8 |
9 |
10 | )
11 | }
12 |
13 | export default EntityLedgers;
--------------------------------------------------------------------------------
/src/links/Login.js:
--------------------------------------------------------------------------------
1 | import React, {useState} from 'react';
2 | import {useHistory} from 'react-router-dom';
3 | import AppContext from '../context/AppContext';
4 | import Form from "react-bootstrap/Form";
5 | import Button from "react-bootstrap/Button";
6 |
7 | import {Api, login} from '../context/Actions';
8 |
9 | const Login = () => {
10 | const {dispatch} = React.useContext(AppContext);
11 |
12 | let history = useHistory();
13 |
14 | const [userID, setUserID] = useState('');
15 |
16 | const handleClick = async (e) => {
17 | e.preventDefault();
18 |
19 | const url = '/persons/' + userID;
20 |
21 | const array = userID.toLowerCase().split("@");
22 | const username = array[0];
23 |
24 | try {
25 | const res = await Api.get(url);
26 | if (res.status === 200) {
27 | dispatch(login(userID, username));
28 | history.push("/mypage");
29 | }
30 | } catch (err) {
31 | alert(err.response.data.message);
32 | }
33 | }
34 |
35 | return (
36 |
37 |
38 |
39 |
40 |
44 | Username
45 | setUserID(e.target.value)}/>
46 |
47 |
48 |
49 | Password
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | );
60 | };
61 |
62 | export default Login;
63 |
--------------------------------------------------------------------------------
/src/links/Logout.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useHistory } from 'react-router-dom';
3 | import AppContext from '../context/AppContext';
4 | import {logout} from '../context/Actions';
5 | import Button from "react-bootstrap/Button";
6 |
7 | function Logout () {
8 | const {dispatch} = React.useContext(AppContext);
9 | let history = useHistory();
10 | const handleClick = () => {
11 | window.location.href = '/';
12 | dispatch(logout());
13 | }
14 |
15 | return (
16 |
17 | );
18 |
19 | }
20 |
21 | export default Logout;
--------------------------------------------------------------------------------
/src/links/MembersGroup.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import EntityMembers from "../entities/groups/Members/EntityMembers";
3 |
4 |
5 | function MembersGroup (){
6 | return (
7 |
8 |
9 |
10 | )
11 |
12 | }
13 |
14 | export default MembersGroup;
--------------------------------------------------------------------------------
/src/links/MyGroups.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import EntityGroup from "../entities/groups/EntityGroup";
3 | import User from "../tables/User/User";
4 |
5 | function MyGroups () {
6 |
7 | return (
8 |
9 |
10 |
11 | )
12 |
13 | }
14 | export default MyGroups;
--------------------------------------------------------------------------------
/src/links/NoRoute.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Redirect } from 'react-router-dom';
3 | import AppContext from '../context/AppContext';
4 | import {logout} from '../context/Actions'
5 |
6 | function NoRoute() {
7 |
8 | const {dispatch} = React.useContext(AppContext);
9 | React.useEffect(() =>{
10 | dispatch(logout());
11 | });
12 | return(
13 |
14 | );
15 | }
16 |
17 | export default NoRoute;
--------------------------------------------------------------------------------
/src/links/PrivateRoute.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Route, Redirect } from 'react-router-dom';
3 | import AppContext from '../context/AppContext';
4 |
5 | /*
6 | { component: XPTO, ...rest }
7 | component: XPTO : Find the component property defined on props (Note: lowercase component) and assign it to a new location in state we call XPTO
8 | ...rest: Then, take all remaining properties defined on the props object and collect them inside an argument called rest.
9 | */
10 |
11 | function PrivateRoute({ component: XPTO, ...rest }) {
12 | const {state} = React.useContext(AppContext);
13 | const {isLogged} = state;
14 | return(
15 | (
16 | isLogged
17 | ? ()
18 | : () )}
19 | />
20 | );
21 | }
22 |
23 | export default PrivateRoute;
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/src/tables/AccountsTable/AccountsTable.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import TableHeader from './TableHeader';
3 | import TableBody from './TableBody';
4 | import Table from "react-bootstrap/Table";
5 |
6 | class AccountsTable extends Component {
7 |
8 | render() {
9 | const headers = this.props.headers;
10 |
11 | console.log ({headers})
12 | const data = this.props.data;
13 |
14 | return (
15 |
19 | );
20 | }
21 | }
22 |
23 | export default AccountsTable;
--------------------------------------------------------------------------------
/src/tables/AccountsTable/TableBody.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class TableBody extends Component {
4 |
5 | render() {
6 | const {data} = this.props;
7 |
8 | const rows = data.map(
9 | (row, index) =>
10 |
11 | {row.denomination} |
12 | {row.description} |
13 |
14 | );
15 |
16 | return (
17 | {rows}
18 | );
19 | }
20 | }
21 |
22 | export default TableBody;
--------------------------------------------------------------------------------
/src/tables/AccountsTable/TableHeader.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class TableHeader extends Component {
4 |
5 | render() {
6 | const {headers} = this.props;
7 | return (
8 |
9 |
10 |
11 | {headers.header1} |
12 | {headers.header2} |
13 |
14 |
15 | );
16 | }
17 | }
18 |
19 | export default TableHeader;
--------------------------------------------------------------------------------
/src/tables/CategoriesTable/CategoriesTable.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import CategoriesTableHeader from './CategoriesTableHeader';
3 | import CategoriesTableBody from './CategoriesTableBody';
4 | import Table from "react-bootstrap/Table";
5 | class CategoriesTable extends Component {
6 |
7 | render() {
8 | const headers = this.props.headers;
9 |
10 | console.log({headers})
11 | const data = this.props.data;
12 |
13 | return (
14 |
18 | );
19 | }
20 | }
21 | export default CategoriesTable;
--------------------------------------------------------------------------------
/src/tables/CategoriesTable/CategoriesTableBody.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class CategoriesTableBody extends Component {
4 |
5 | render() {
6 | const {data} = this.props; // data = this.props.data;
7 |
8 | const rows = data.map(
9 | (row, index) =>
10 |
11 | {row} |
12 |
13 | )
14 |
15 | return (
16 | {rows}
17 | );
18 | }
19 | }
20 |
21 | export default CategoriesTableBody;
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/tables/CategoriesTable/CategoriesTableHeader.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class CategoriesTableHeader extends Component {
4 |
5 | render() {
6 | const {headers} = this.props;
7 | return (
8 |
9 |
10 | {headers.header1} |
11 |
12 |
13 | );
14 | }
15 | }
16 |
17 | export default CategoriesTableHeader;
--------------------------------------------------------------------------------
/src/tables/GroupsTable/GroupsTable.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import TableBody from "./TableBody";
3 | import TableHeader from "./TableHeader";
4 | import Table from "react-bootstrap/Table";
5 |
6 | class GroupsTable extends Component {
7 |
8 | constructor(props) {
9 | super(props);
10 | }
11 | render() {
12 | const headers = this.props.headers;
13 |
14 | console.log({headers})
15 | const data = this.props.data;
16 |
17 | return (
18 |
22 | );
23 | }
24 | }
25 |
26 | export default GroupsTable;
--------------------------------------------------------------------------------
/src/tables/GroupsTable/TableBody.js:
--------------------------------------------------------------------------------
1 | import React, {useContext} from 'react';
2 | import AppContext from "../../context/AppContext";
3 | import {useHistory} from 'react-router-dom';
4 | import {setGroupDenomination} from "../../context/Actions";
5 |
6 | function GroupsTableBody() {
7 | const {state, dispatch} = useContext(AppContext);
8 | const {groups} = state;
9 |
10 | const {groupsData} = groups;
11 |
12 | let history = useHistory();
13 |
14 | const handleOnClick = (denomination) => {
15 |
16 | dispatch(setGroupDenomination(denomination));
17 |
18 | history.push("/myGroups/" + denomination)
19 | }
20 |
21 | const rows = groupsData.map((row, index) => {
22 |
23 | return (
24 |
25 | handleOnClick(row.denomination)}>{row.denomination} |
26 | {row.description} |
27 | {row.dateOfCreation} |
28 |
29 |
30 | )
31 | });
32 | return (
33 |
34 | {rows}
35 | );
36 | }
37 |
38 | export default GroupsTableBody;
--------------------------------------------------------------------------------
/src/tables/GroupsTable/TableHeader.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class TableHeader extends Component {
4 | constructor(props) {
5 | super(props);
6 | }
7 |
8 | render() {
9 | const {headers} = this.props;
10 | return (
11 |
12 |
13 | {headers.header1} |
14 | {headers.header2} |
15 | {headers.header3} |
16 |
17 |
18 | );
19 | }
20 | }
21 |
22 | export default TableHeader;
--------------------------------------------------------------------------------
/src/tables/LedgersTable/LedgerTable.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import LedgerTableBody from "./LedgerTableBody";
3 | import LedgerTableHeader from "./LedgerTableHeader";
4 | import Table from "react-bootstrap/Table";
5 |
6 | class LedgerTable extends Component {
7 |
8 | constructor(props) {
9 | super(props);
10 | }
11 |
12 | render() {
13 |
14 | const headers = this.props.headers;
15 | const data = this.props.data;
16 |
17 | return (
18 | //
19 |
20 | {/**/}
23 |
24 |
25 |
26 |
27 |
28 | );
29 | }
30 | }
31 | export default LedgerTable
--------------------------------------------------------------------------------
/src/tables/LedgersTable/LedgerTableHeader.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class LedgerTableHeader extends Component {
4 | constructor(props) {
5 | super(props);
6 | }
7 |
8 | render() {
9 | const {headers} = this.props;
10 | return (
11 |
27 | );
28 | }
29 | }
30 |
31 | export default LedgerTableHeader;
--------------------------------------------------------------------------------
/src/tables/MembersTable/MembersTable.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from "react";
2 | import MembersTableHeader from "./MembersTableHeader";
3 | import MembersTableBody from "./MembersTableBody";
4 | import Table from "react-bootstrap/Table";
5 |
6 |
7 | class MembersTable extends Component {
8 |
9 | constructor(props) {
10 | super(props);
11 | }
12 |
13 | render() {
14 | const headers = this.props.headers;
15 | const data = this.props.data;
16 |
17 | return (
18 |
22 | );
23 | }
24 |
25 | }
26 |
27 | export default MembersTable
--------------------------------------------------------------------------------
/src/tables/MembersTable/MembersTableBody.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class MembersTableBody extends Component {
4 | constructor(props) {
5 | super(props);
6 | }
7 |
8 | render() {
9 | const {data} = this.props;
10 |
11 | const rows = data.map(
12 | (row, index) =>
13 |
14 | {row.memberID} |
15 | {row.clearance} |
16 |
17 |
18 | );
19 |
20 | return (
21 |
{rows}
22 | );
23 | }
24 | }
25 |
26 | export default MembersTableBody
--------------------------------------------------------------------------------
/src/tables/MembersTable/MembersTableHeader.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 |
3 | class MembersTableHeader extends Component {
4 |
5 | constructor(props) {
6 | super(props);
7 | }
8 |
9 | render() {
10 | const {headers} = this.props;
11 | return (
12 |
13 |
14 | {headers.header1} |
15 | {headers.header2} |
16 |
17 |
18 | );
19 | }
20 | }
21 |
22 | export default MembersTableHeader;
--------------------------------------------------------------------------------
/src/tables/User/User.js:
--------------------------------------------------------------------------------
1 | import React, {Component, useContext, useState} from "react";
2 | import axios from 'axios';
3 | import AppContext from "../../context/AppContext";
4 |
5 |
6 | const api = axios.create({
7 | baseURL: 'http://localhost:8080'
8 | })
9 |
10 | function User() {
11 | const {state, dispatch} = useContext(AppContext);
12 | const {user} = state;
13 |
14 | return (
15 |
{user}
16 | )
17 | }
18 | export default User
19 |
--------------------------------------------------------------------------------