Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projeto Sistema de Pagamentos #21

Open
wants to merge 274 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
274 commits
Select commit Hold shift + click to select a range
d1c65c9
feat(mysql.ts): create function connect to db remotely
oseias-costa Jan 5, 2024
a4720b3
fix(user.usecase.ts): fixed methods GetUser and CreateUser with token…
oseias-costa Jan 5, 2024
d640dc3
fix(user.entity.ts): fixed return GetUser to string
oseias-costa Jan 5, 2024
99aef38
feat: create Login route with jwttoken return
oseias-costa Jan 5, 2024
43d0082
feat: create Login route with token return
oseias-costa Jan 5, 2024
8b930f9
feat(balance.entity): create Balance type and interface to usecases
oseias-costa Jan 5, 2024
e1ae1c1
feat(balance.entity): export type Balance
oseias-costa Jan 5, 2024
9bb2f7e
fix(balance.entity): fixed return methods with Promise
oseias-costa Jan 5, 2024
bb1b3be
feat(user.entity): create UserInfo type
oseias-costa Jan 5, 2024
3924e7f
fix(balance.entity): fixed args to userInfo, balanceName and amount
oseias-costa Jan 5, 2024
95cbd5c
feat(middleware.ts) create midleware to verify jwt
oseias-costa Jan 5, 2024
6e5cde1
chore(.gitignore): included folder .yarn to ignore
oseias-costa Jan 5, 2024
d7fa8fc
feat(server.ts): create route balance for CreateBalanceController
oseias-costa Jan 5, 2024
6875d66
feat(balance.usecase.ts): create class BalanceUseCase
oseias-costa Jan 5, 2024
7c77160
feat(balance.controller.ts): create class controller to balance
oseias-costa Jan 5, 2024
0d3164b
fix(user.controller): fixed method CreateUser
oseias-costa Jan 5, 2024
ef0f2e4
feat(balance.usecase): create static method validateBalance
oseias-costa Jan 5, 2024
b414525
feat(balance.usecase): implement method GetallBalances and CreateBalance
oseias-costa Jan 6, 2024
58fb6e4
feat(balance.controller): create methods CreateBalanceController and …
oseias-costa Jan 6, 2024
1aae35a
feat(balance.repository): create class BalanceRepository with methods…
oseias-costa Jan 6, 2024
f937024
feat(server.ts): create routes for balance get and post
oseias-costa Jan 6, 2024
022fcb5
feat(balance.usecase): create methods DeleteBalance and UpdateBalance…
oseias-costa Jan 6, 2024
b5840fa
fix(balance.entity.ts):update arguments for interface UpdateBalanceName
oseias-costa Jan 6, 2024
b8c12ee
feat(balance.repository): implemented methods DeleteBalances and Upda…
oseias-costa Jan 6, 2024
57b469a
feat(server.ts): implemented delete and update routes for balance
oseias-costa Jan 6, 2024
445db01
feat(balance.repository): implemented methods UpdateNameBalance and D…
oseias-costa Jan 6, 2024
1a90731
feat(balance.controller): included DeleteBalanceController and Update…
oseias-costa Jan 6, 2024
87f1d68
feat(payment.entity): create type Payment and interface PaymentInterface
oseias-costa Jan 6, 2024
eb15fba
fix(payment.entity): included id on type Payment
oseias-costa Jan 6, 2024
547d543
feat(payment.usecase): create PaymentUseCase class with method Create…
oseias-costa Jan 6, 2024
c963fc7
feat(payment.usecase.ts): included call to repository on method Creat…
oseias-costa Jan 6, 2024
eeb93f7
fiz(payment.entity): included id on type Payment
oseias-costa Jan 6, 2024
88ad5f4
feat(server.ts): included CreatePayment route
oseias-costa Jan 6, 2024
88e52e9
feat(payment.repository.ts): create class PaymentRepository with meth…
oseias-costa Jan 6, 2024
c127c79
feat(payment.controller): create class PaymentController and method C…
oseias-costa Jan 6, 2024
e059708
feat(payment.entity): included on interface PaymentInterface methods …
oseias-costa Jan 7, 2024
35d6e2e
feat(payment.usecase): implemented methods DeletePayment and UpdatePa…
oseias-costa Jan 7, 2024
73cb20a
feat(payment.controller): implemented controllers DeletePayment and U…
oseias-costa Jan 7, 2024
c0fafb3
feat(server.ts): created routes for pacth and delete
oseias-costa Jan 7, 2024
ab2fa84
feat(payment.repository): create requests to db with methods DeletePa…
oseias-costa Jan 7, 2024
3956a96
feat(payment.repository): created method VerifyBalanceAmount
oseias-costa Jan 7, 2024
a1cea00
feat(mysql.ts): included multipleStatements = true on argmunts
oseias-costa Jan 7, 2024
ed21e95
fix(payment.usecase): add rules to save payment when the amount is le…
oseias-costa Jan 7, 2024
05190be
fix(payment.repository): fixed query to create new payment
oseias-costa Jan 7, 2024
1ca5ae2
fix: included the desctiption field in the Balance type and corrected…
oseias-costa Jan 7, 2024
b8a6268
build: create development environment with react/typescript/MaterialUI
oseias-costa Jan 7, 2024
1623ad6
feat(Login.tsx): create page login
oseias-costa Jan 7, 2024
3f2e989
feat(Register.tsx): created Register page
oseias-costa Jan 7, 2024
74e67c6
feat(Layout.tsx): create Layout page
oseias-costa Jan 7, 2024
5f1eb1f
build(package.json, yarn.lock): add dependency react-router-dom
oseias-costa Jan 7, 2024
b44c393
feat(PrivateRoute.tsx): create private routes
oseias-costa Jan 7, 2024
124bdee
feat(RenderRouter.tsx):created render router file whit createBrowserR…
oseias-costa Jan 7, 2024
781c9c1
feat(main.tsx): included RouterProvider with router
oseias-costa Jan 7, 2024
f686d3f
feat(Layout): create sctructure and for layout page with menu and header
oseias-costa Jan 8, 2024
b1c729e
feat(layout.style): create styles to layout menu and header
oseias-costa Jan 8, 2024
2e3c01b
fix(Register.tsx, Login.tsx): navigation return defined if user is true
oseias-costa Jan 8, 2024
89f54e0
fix(PrivateRoute): set user to true for tests
oseias-costa Jan 8, 2024
fb5f963
feat(RenderRouter): included route /pagamentos to router
oseias-costa Jan 8, 2024
aa7c760
feat(Title): created component Title
oseias-costa Jan 8, 2024
c74eb92
feat(EmptyTable.tsx): created component EmptyTable
oseias-costa Jan 8, 2024
9e588d7
feat(PaymentTable): created component PaymentTable
oseias-costa Jan 8, 2024
e0b6d98
feat(layout.style): created style pageContent with padding
oseias-costa Jan 8, 2024
522a5f7
feat(Layout): created Box with style pageContent with children Outlet
oseias-costa Jan 8, 2024
8bc7e43
fix(Title.tsx): remove padding
oseias-costa Jan 8, 2024
cef9860
fix(EmptyTable.tsx): fixed width
oseias-costa Jan 8, 2024
29f5a7c
created page Payment
oseias-costa Jan 8, 2024
c2bd4c5
feat(TitleWithButton): created TitleWithButton component
oseias-costa Jan 8, 2024
3c8a755
fix(TitleWithButton): fixed Link on Button
oseias-costa Jan 8, 2024
3d71782
feat(RenderRouter.tsx): included route /pagamentos/criar with compone…
oseias-costa Jan 8, 2024
41e0098
feat(SelectBalance.tsx): create SelectBalance component
oseias-costa Jan 8, 2024
2af4caa
feat(FormButtons): created component with Buttons Cancelar and Criar
oseias-costa Jan 8, 2024
267ec49
feat(FormContainer): created component to container for
oseias-costa Jan 8, 2024
1a35ea3
feat(NewPayment): created page NewPayment
oseias-costa Jan 8, 2024
d36f193
feat(Payment): included PaymentTable component
oseias-costa Jan 8, 2024
de6c0d3
fix(App.tsx): remove content
oseias-costa Jan 8, 2024
70fc450
fix(main.tsx): fixed router Provider
oseias-costa Jan 8, 2024
1be8b25
feat(RenderRouter): included route /pagamentos/editar
oseias-costa Jan 8, 2024
f0d0461
feat(UpdatePayment): create page UpdatePayment
oseias-costa Jan 8, 2024
58a6b03
feat(RenderRouter): included route /saldos on private routes
oseias-costa Jan 8, 2024
14ede4b
feat(BalanceTable.tsx): create table to Balance
oseias-costa Jan 8, 2024
4663309
fix(BalanceTable): fixed label names on table head
oseias-costa Jan 8, 2024
52cd2d3
feat(Balance.tsx): created page Balance
oseias-costa Jan 8, 2024
6b9b923
feat(RenderRouter): included route saldos/criar
oseias-costa Jan 8, 2024
c0314af
feat(NewBalance.tsx): create page NewBalance
oseias-costa Jan 8, 2024
587161f
feat(RenderRouter.tsx): included route saldos/editar
oseias-costa Jan 8, 2024
54f301b
feat(UpdateBalance): create page UpdateBalance
oseias-costa Jan 8, 2024
cdde885
fix(UpdateBalance.tsx, RenderRouter.tsx): fixed component name to Upd…
oseias-costa Jan 8, 2024
d191f47
fix(Layout): change button hover color
oseias-costa Jan 8, 2024
9db741c
fix(layout.style.ts): update button hover color
oseias-costa Jan 8, 2024
d9d2d93
fix(PrivateRoute): update user to false for tests
oseias-costa Jan 8, 2024
afd68a5
build(package.json, yarn.lock): add dependency axios
oseias-costa Jan 8, 2024
07f9e6b
feat(Login.tsx): implementend function login
oseias-costa Jan 8, 2024
a895d71
feat(Register): implemented function register
oseias-costa Jan 8, 2024
5d67cd6
fix(server.ts): remove middleware to route user for register
oseias-costa Jan 8, 2024
b4f91e6
build(package.json, yarn.lock): add dependecies react-redux and redux…
oseias-costa Jan 8, 2024
167b441
feat(user.entity): included UserAndToken type
oseias-costa Jan 8, 2024
fe68afb
feat(user.entity): included UserAndToken type on returno method GetUser
oseias-costa Jan 8, 2024
650678a
fix(user.usecase): fixed methods returns and validate password before…
oseias-costa Jan 8, 2024
55d5ceb
chore(.gitignore): included .yarn and .yarnrc.yml
oseias-costa Jan 8, 2024
dc6c747
feat(user.usecase): return correctly user
oseias-costa Jan 8, 2024
777dd1e
feat(main.tsx): included Provider store redux
oseias-costa Jan 8, 2024
6b1fc96
feat(store.tsx): create redux store
oseias-costa Jan 8, 2024
275bf24
feat(user.slice): creted user slice with fetchUser
oseias-costa Jan 8, 2024
db712db
feat(PrivateRoute.tsx): included global state user
oseias-costa Jan 8, 2024
2b1192f
feat(Layout.tsx): included on logout button handleLogout function
oseias-costa Jan 8, 2024
2accb2c
feat(Login.tsx): included user global state
oseias-costa Jan 8, 2024
ac2959c
feat(Register.tsx): included user global state
oseias-costa Jan 8, 2024
b71ffb4
feat(register.ts): created function findField
oseias-costa Jan 8, 2024
053b233
fix(user.usecase): remove verify duplicate to password
oseias-costa Jan 8, 2024
a744cd3
fix(PrivateRoute.tsx): Fixed return
oseias-costa Jan 8, 2024
bd57ebd
feat(payment.slice.ts): create payment slice for global state
oseias-costa Jan 9, 2024
3d9a409
feat(store.ts): included payment reducer on store
oseias-costa Jan 9, 2024
0243b57
design(payment.slice): indentation improvement
oseias-costa Jan 9, 2024
161a195
feat(http.ts): created httpClient function
oseias-costa Jan 9, 2024
b0cf59e
feat(useGetPayments): created hook
oseias-costa Jan 9, 2024
99b88ed
fix(user.slice): return reducer fetchUser with void
oseias-costa Jan 9, 2024
ba09275
fix(PaymentTable): fixed data payment on table
oseias-costa Jan 9, 2024
f091a3e
fix(Payment): fixed pass props to payment table and fixed path to emp…
oseias-costa Jan 9, 2024
37d8cc7
fix(EmptyTable): fixed Link to button
oseias-costa Jan 9, 2024
4db5c53
fix(PaymentTable.tsx): fixed type params conflit
oseias-costa Jan 9, 2024
c40b3d7
fix(Payment): pass props fixed
oseias-costa Jan 9, 2024
3e35b91
fix(NewPayment.tsx): fixed style for text input
oseias-costa Jan 9, 2024
8a98082
feat(NewPayment.tsx): included newPayment state with onChange on inputs
oseias-costa Jan 9, 2024
457e4b7
feat(balance.slice): created balance slice
oseias-costa Jan 9, 2024
45d34f3
feat(store.tsx): included balanceSlice to store
oseias-costa Jan 9, 2024
349899a
feat(global.styles.ts): created file and create inputStyle
oseias-costa Jan 9, 2024
04bb30e
fix(PaymentTable): fixed params and create let rows
oseias-costa Jan 9, 2024
ccfbfa4
fix(Payment.tsx): change props to payment on PaymentTable component
oseias-costa Jan 9, 2024
9b63c64
fix(PaymentTable): fixed statement to get payment prop
oseias-costa Jan 9, 2024
6a6ff0e
fix(Payment): pass correctly prop to component
oseias-costa Jan 9, 2024
f8517ac
feat(useGetBalance.tsx): created custom hook to get balance data
oseias-costa Jan 9, 2024
37ad986
fix(Balance.tsx): pass props data to BalanceTable
oseias-costa Jan 9, 2024
b1edda3
fix(FormButtons): included props path, textButton and onClick
oseias-costa Jan 9, 2024
5024571
fixed(httpClient): included headers content-type and accept on httpCl…
oseias-costa Jan 9, 2024
14f8484
feat(BalanceTable): included Link to edit button
oseias-costa Jan 9, 2024
32f1eb3
fix(useGetPayments): included usestate
oseias-costa Jan 9, 2024
b4a3220
feat(UpdateBalance): create balance state to change name, and onChang…
oseias-costa Jan 9, 2024
f3694a1
chore(yarn.lock): changes to dependency redux
oseias-costa Jan 9, 2024
14c3174
fix(Login): fixed Login and redirect to /pagamentos
oseias-costa Jan 9, 2024
fa2c9d8
fix(Register): fixed redirect to /pagamentos
oseias-costa Jan 9, 2024
82d206e
feat(App): included variable token
oseias-costa Jan 9, 2024
8c3d9cd
feat(balance.slice): created reducer updateName on balanceSlice
oseias-costa Jan 9, 2024
d17f516
fix(balance.slice): fixed export reducer updateName
oseias-costa Jan 9, 2024
129d0f4
fix(useGetBalance.tsx): fixed use global state
oseias-costa Jan 9, 2024
5da633d
fix(BalanceTable.tsx): fixed component params
oseias-costa Jan 9, 2024
5d54be2
fix(Balance.tsx): fixed args name rows to component BalanceTable
oseias-costa Jan 9, 2024
641cdc7
feat(UpdateBalance.tsx): included return to /saldos
oseias-costa Jan 9, 2024
20d0a9c
feat(UpdateBalance.tsx): included return to /saldos
oseias-costa Jan 9, 2024
37e62bb
fix(http.tsx): fixed token string send
oseias-costa Jan 9, 2024
fd3750e
feat(balance.slice): created action CreateBalance
oseias-costa Jan 9, 2024
9569a48
feat(NewBalance): implemented handleCreateBalance function
oseias-costa Jan 9, 2024
e472135
fix(useGetPayments): fixed return with global state
oseias-costa Jan 9, 2024
cdfd055
feat(payment.slice): created updatePaymentName and createPayment actions
oseias-costa Jan 9, 2024
05a476f
feat(PaymentTable): included Link to /pagamentos/editar
oseias-costa Jan 9, 2024
dbfdac9
feat(UpdatePayment): created state to newName
oseias-costa Jan 9, 2024
beea63b
chore(yarn.lock): update new dependecies
oseias-costa Jan 9, 2024
2526245
fix(UpdatePayment): fixed httpClient arguments
oseias-costa Jan 9, 2024
593e6e3
fix(SelectBalance): fixed balance state and useState prop to component
oseias-costa Jan 10, 2024
b390753
fix(payment.repository): fixed variable newBalanceUsed sum
oseias-costa Jan 10, 2024
d227f0e
fix(SelectBalance): change global state to useGetBalance
oseias-costa Jan 10, 2024
f5aeda8
feat(NewPayment): implemented function handleCreatePayment
oseias-costa Jan 10, 2024
e917825
feat(balance.slice): created deacreseBalance action
oseias-costa Jan 10, 2024
126f3d5
feat(payment.repository): create method GetPaymentById
oseias-costa Jan 10, 2024
a5ef62e
feat(payment.repository): included on PaymentRepositoryInterface meth…
oseias-costa Jan 10, 2024
6049848
feat(payment.repository): fixed query method GetPaymentById and return
oseias-costa Jan 10, 2024
4eddfd6
fix(payment.usecase): fixed method DeletePayment whith methods params…
oseias-costa Jan 10, 2024
171fd74
fix(payment.usecase): fixed usecase DeletePayment method
oseias-costa Jan 10, 2024
eb61330
feat(balance.repository): created GetBalanceById method
oseias-costa Jan 10, 2024
779363e
feat(balance.usecase): included verifyBalance variable
oseias-costa Jan 10, 2024
68d4822
feat(balance.slice): implemented action deleteBalanceState
oseias-costa Jan 10, 2024
93db401
feat(DeleteModal): Modal to delete balance
oseias-costa Jan 10, 2024
ed4ad1d
feat(BalanceTable): included DeleteModal component
oseias-costa Jan 10, 2024
e08388f
feat(increaseBalance): implemented increaseBalance reducer
oseias-costa Jan 10, 2024
c55755c
feat(payment.slice): created deletePaymentAction reducer
oseias-costa Jan 10, 2024
a80ab86
feat(DeletePayment): created modal to delete paymento
oseias-costa Jan 10, 2024
b9b26ef
fix(paymento.slice): fixed types on fetchPayments and createPayment r…
oseias-costa Jan 10, 2024
2961232
feat(BalanceTable.tsx): included DeleteModal component
oseias-costa Jan 10, 2024
ea38fca
feat(PaymentTable.tsx): included DeletePayment modal component
oseias-costa Jan 10, 2024
01ae4c3
feat(user.repository): created getUserById repository method
oseias-costa Jan 10, 2024
75a2edf
feat(user.usecase): included GetUserById method
oseias-costa Jan 10, 2024
08092ff
feat(user.entity): included GetUserById on interface User
oseias-costa Jan 10, 2024
d9ff251
feat(server.ts): create route get user
oseias-costa Jan 10, 2024
3cf0446
feat(user.controller): create GetUserById method
oseias-costa Jan 10, 2024
9dd83af
feat(Load): create load component
oseias-costa Jan 10, 2024
f5b6fb8
feat(App.tsx): included Load component and verify token
oseias-costa Jan 10, 2024
600e608
fix(UpdatePayment): fixed disable select balance
oseias-costa Jan 10, 2024
08211f9
feat(Notification.tsx): created component to notification
oseias-costa Jan 10, 2024
1338a99
fix(App.tsx): remove notification to App
oseias-costa Jan 10, 2024
e7b4d60
feat(Balance): send notification if status ok
oseias-costa Jan 10, 2024
b2c0605
feat(Payment): send notification case create payment
oseias-costa Jan 10, 2024
b115f53
feat(NewBalance): implement errors message on inputs
oseias-costa Jan 10, 2024
90c15f7
feat(UpdateBalance.tsx): included error checking
oseias-costa Jan 10, 2024
2992396
feat(balanceErrorMessages): function created to converted error messages
oseias-costa Jan 10, 2024
a0f4e72
feat(SelectBalance.tsx): included checking errors
oseias-costa Jan 10, 2024
6dba37e
feat(NewPayment): included checking errors
oseias-costa Jan 10, 2024
f553141
fix(refactor): remove console.log
oseias-costa Jan 10, 2024
8f7db13
feat(User.tsx): create User page
oseias-costa Jan 10, 2024
2219c12
feat(Layout): included Link for /usuario
oseias-costa Jan 10, 2024
30109e6
feat(RenderRouter): included route /usuario
oseias-costa Jan 10, 2024
51f0489
refactor(User): update indentation
oseias-costa Jan 11, 2024
88cbd32
feat(paymentErrorMessages): create converted error function
oseias-costa Jan 11, 2024
b4a1732
feat(Layout): included button to open menu
oseias-costa Jan 11, 2024
b26c240
feat(layout.styles): included styles to menu, buttonMenu
oseias-costa Jan 11, 2024
d0be54d
fix(FormContainer): fixed container height size on mobile screen
oseias-costa Jan 11, 2024
4c353fb
feat(Layout): included setOpen on button menu
oseias-costa Jan 11, 2024
3c50460
fix(UpdatePayment): fixed findBalance[0]?.balanceName
oseias-costa Jan 11, 2024
4e50ac6
fix(layout.style): layout menu and header position fixed
oseias-costa Jan 11, 2024
0c2ba14
feat(Login.tsx): included checking error on textFields
oseias-costa Jan 11, 2024
126dc9e
feat(user.usecase): included email verify variable
oseias-costa Jan 11, 2024
1325e36
feat(registerErrorMessages): function created to convert error messages
oseias-costa Jan 11, 2024
e8b31c6
fix(Layout): fixed locaStorage item name
oseias-costa Jan 11, 2024
8416b8f
fix(User): fixed locaStorage item name
oseias-costa Jan 11, 2024
a6b871d
fix(App.tsx): fixed load with setTimeout
oseias-costa Jan 11, 2024
a5d9cc2
feat(verifyPassword): check if password is valid
oseias-costa Jan 11, 2024
b11756c
refactor(Register): update function name register to handleRegister
oseias-costa Jan 11, 2024
208c841
feat(DeleteBalance.tsx): update component name and created messages t…
oseias-costa Jan 11, 2024
638f276
fix(BalanceTable): fixed notifications message state with type
oseias-costa Jan 11, 2024
65c4bd2
fix(BalanceTable): fixed notifications message state with type
oseias-costa Jan 11, 2024
657e568
fix(DeletePayment): fixed message state with type
oseias-costa Jan 11, 2024
c9a4b02
fix(Notification): fixad new field type on state
oseias-costa Jan 11, 2024
c39d199
design(RenderRouter): remove spaces
oseias-costa Jan 11, 2024
38f8f2c
fix(Balance.tsx, Payment.tsx): removed Notification component and imp…
oseias-costa Jan 11, 2024
4d107ac
feat(index.html): included favicon.ico
oseias-costa Jan 11, 2024
482a092
fixed(Payment.tsx): inluded Notification component again
oseias-costa Jan 11, 2024
8fe10e0
fixed(Balance.tsx): inluded Notification component again
oseias-costa Jan 11, 2024
dfd5177
chore(public): remove folder public
oseias-costa Jan 11, 2024
65cb3e6
build(package.json): add @types/node devDepency
oseias-costa Jan 11, 2024
05b69bd
feat(.env-example): created file example of the environment variables
oseias-costa Jan 11, 2024
0f0ab7e
fix(user.usecase): fixed secret key to jwt sign
oseias-costa Jan 11, 2024
e01abc2
feat(.giginore): included folder ./dist
oseias-costa Jan 11, 2024
9aba4d0
fix(server.ts): remove console.log
oseias-costa Jan 11, 2024
7da888f
fix(process.env): corrected usage from process.env
oseias-costa Jan 11, 2024
2a24f6e
chore(db_mysql.sql): include db structure file
oseias-costa Jan 11, 2024
60e5e12
build: update errors tsc
oseias-costa Jan 11, 2024
beaf66a
feat(package.json): included script start
oseias-costa Jan 11, 2024
552676d
feat: created baseUrl variable
oseias-costa Jan 11, 2024
a78aac8
chore: fix word excluído
oseias-costa Jan 11, 2024
db6bd3c
docs(README.md): created redme
oseias-costa Jan 11, 2024
1498d72
fix: fixed increase and decrese reducers and included increase balanc…
oseias-costa Jan 12, 2024
b62b30a
feat(http.ts): update baseUrl to aws lambda endpoint
oseias-costa Jan 12, 2024
683be13
fix(NewPayment.tsx): fixed arguments to decreaseBalance dispatch
oseias-costa Jan 12, 2024
28d0336
feat: included loading on buttons
oseias-costa Jan 12, 2024
c43ac8f
fix: Aligned design EmptyTable mobile size
oseias-costa Jan 12, 2024
7e5bbbb
fix(EmptyTable): fixed text-alitn
oseias-costa Jan 12, 2024
5b8b932
fix: fixed width on EmptyTable
oseias-costa Jan 12, 2024
7b0bc3c
build: created test jest setup and balance tests
oseias-costa Jan 12, 2024
cbe509a
test(balance.soec.ts): createBalance tests
oseias-costa Jan 13, 2024
d214277
test(balance.soec.ts): createBalance tests
oseias-costa Jan 13, 2024
a7897e7
fix: testing balance use case
oseias-costa Jan 13, 2024
e96e356
feat: created new route
oseias-costa Feb 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 68 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,80 @@
# 🚀 Venha participar do nosso time campeão!
# Sistema de Pagamentos!

Ao conhecer uma pessoa que está aplicando para a Incentive.me gostamos de ter uma conversa sobre código. Afinal, escrever, ler e discutir sobre código faz parte da nossa rotina diária de trabalho.
Projeto para o desafio técnico da empresa Incentive.me. O projeto escolhido foi o Sistema de Pagamentos, o resultado você pode acessar em:
https://payment-system-oseias.vercel.app/

Você pode implementar o projeto usando qualquer linguagem de sua preferência. Lembre-se: use a linguagem com a qual você tem mais familiaridade.
# Api

## O que vamos avaliar?
## Descrição

- Comunicação na revisão do código;
- Argumentos sobre desafios enfrentados e escolhas realizadas na implementação;
- Código bem escrito, limpo e coeso;
- Arquitetura e princípios de desenvolvimento;
- Documentação (README.md) com instruções claras para reproduzir o projeto;
- Uso adequado de versionamento do código em git;
- Uso de testes automatizados;
- Deploy da aplicação;
- O design da API RESTful é implementado, usando corretamente os verbos HTTP e o código de status apropriado;
- Uso adequado de HTML5, CSS3 e JavaScript em um front-end minimamente estruturado;
A api foi desenvolvida em NodeJS seguindo a filosofia de design Clean Architecture, onde são abastraídas e separadas as responsabilidades em cada camada.

Caso você não se sinta confortável com algum desses itens, tudo bem, apenas nos fale sobre isso, ok? O objetivo aqui não é te fazer perder tempo com algo irrelevante. Nosso objetivo aqui é ter um código sobre o qual podemos conversar. Como você deve ter notado, a gente preza muito por colaboração, trabalho em time e comunicação. O objetivo aqui é ter, minimamente, essa experiência com você.
#### Bibliotecas Utilizadas

Respeite o seu nível de conhecimento e experiência, o importante é você saber dizer o motivo das suas escolhas. Se você tiver qualquer dúvida, por favor, entre em contato com a gente. Estamos disponíveis para te ajudar a finalizar esse processo.
- Express, nodemon e sucrase
- dotenv, cors
- JsonWebToken, uuid e Bcrypt
- mysql2

# Opções de projetos

A seguir seguem algumas ideias de projetos que você pode implementar:
### Instalação da Api

- [Cliente para o GitHub](https://github.com/incentive-me/projeto-selecao/blob/master/projects/GITHUB.md);
- [Sistema de pagamentos](https://github.com/incentive-me/projeto-selecao/blob/master/projects/PAGAMENTOS.md).
- **Projeto open source próprio**: Se você tiver algum projeto pronto, que tenha relação com desenvolvimento Web, você pode apresentá-lo na entrevista. Conte-nos sobre suas motivações ao criá-lo, os desafios técnicos e não técnicos enfretados etc. O objetivo aqui é poupar seu tempo
e evitar que você tenha que criar outro projeto, caso já tenha um.
Faça um fork do projeto. Entre no diretório ./api e digite o comando:
```bash
$ yarn install
```

# Como compartilhar o projeto conosco
Após instalar as dependências do projeto, crie um arquivo .env e coloque as variáveis de ambiente conforme o arquivo .env-example.

1. Apague este README.md e adicione informações que achar relevante como configurar o projeto, contendo os comandos que devem ser executados para executar ele e os testes;
2. Abra um PR apontando para a branch master deste repositório;
3. Escreva qualquer consideração na descrição do PR e faça qualquer comentário que achar pertinente no código.
Você precisará criar um banco de dados mysql para rodar o projeto, para isso separei um arquivo db_mysql.sql como exemplo de relacionamentos das tabelas.

**OBS.:** Caso queira nos mostra um projeto open source próprio, abra uma issue nesse repositório aqui, colocando links e informações sobre o seu projeto de forma que possamos avaliá-lo.
Com isso pronto rode o comando:

```bash
$ yarn build
```

Após o buid, rode o comando para iniciar o servidor:

```bash
$ yarn start
```

A api estará rodando localmente na porta http://localhost:3001/

# Frontend

O frontend foi desenvolvido, conforme a sugestão, em ReactJS.

#### Bibliotecas Utilizadas

- React-router-dom, axios
- MaterialUI
- Redux

### Instalação do Frontend

Entre no diretório .frontend-payment-system e rode o comando:

```bash
$ yarn install
```

Após instalar as dependências, entre no diretório ./src/utils/http.ts e altere a variável baseUrl para o endereço local:

```js
export const baseUrl: string = "http://localhost:5173/"
```

Após isso estamos prontos para inicializar com o seguinte comando:

```bash
$ yarn dev
```

O frontend já estará funcionando e rodando localmente na porta http://localhost:5173

## Sobre mim

Sou Oséias Costa, desenvolvedor fullstack. Caso tiver dúvidas me coloco a disposição para ajudar. Me chame no linkedin:
https://www.linkedin.com/in/oseias-costa/
10 changes: 10 additions & 0 deletions api/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Put the remote mysql database keys here
DB_HOST = "00.000.000.00"
DB_USERNAME = "db_usename"
DB_PASSWORD = "db_password"
DB_NAME = "db_name",


# choose a secret key for jwt
SECRETJWT = "0000"
33 changes: 33 additions & 0 deletions api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
"parser": "@typescript-eslint/parser",
"env": {
"browser": true,
"es2021": true
},
"plugins": ["@typescript-eslint"],
"extends": [
"plugin:@typescript-eslint/recommended",
"standard-with-typescript",
"prettier/@typescript-eslint"
],

"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
}
}
7 changes: 7 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.env
.yarn
./dist
/dist
/build
/coverage
1 change: 1 addition & 0 deletions api/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
84 changes: 84 additions & 0 deletions api/application/__tests__/balance.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import BalanceRepository from "../../infra/repository/balance.repository"
import { BalanceUseCase } from "../balance.usecase"

jest.mock("../../infra/repository/balance.repository")

export const userInfo = {
id: 'a5dcb5d7-f74c-4d41-ac7c-dba6bf54be2f',
email: '[email protected]',
iat: 1705089085,
exp: 1705096285
}

const balance = {
"id": "2819c519-b515-4b6f-976d-2af0a8e54dec",
"balanceName": "teste",
"initialValue": 50,
"valueUsed": 0,
"totalValue": 50,
"userId": "a5dcb5d7-f74c-4d41-ac7c-dba6bf54be2f",
"description": "1234"
}

const RepoMock = BalanceRepository as jest.Mock<BalanceRepository>;
const usecase = balanceUseCase()

function balanceUseCase(){
const BalanceRepository = new RepoMock() as jest.Mocked<BalanceRepository>
const balanceUseCase = new BalanceUseCase(BalanceRepository)
return balanceUseCase
}

describe("should create balance", () => {
let amount: number

it("should throw if balance name is empty", async () => {
const t = usecase.CreateBalance(userInfo, "", 1000, "Descript")

await expect(t).rejects.toThrow("Balance Name is required")
})

it("should throw if balance amount is empty", async ()=> {
const t = usecase.CreateBalance(userInfo, "Oséias", amount, "")

await expect(t).rejects.toThrow("Balance Amount is required")
})
})

// describe('Should get all balances', () => {
// const balances: Balance[] = []
// const usecase = balanceUseCase()

// it('Should call GetAllBalances', async () => {
// const t = await usecase.GetAllBalances(userInfo)

// await expect(t).resolves.toBe(balances)
// })
// })

describe('Should update balance Name', () => {
let id: string

it('Should more then 3 letters', async () => {
const t = usecase.UpdateBalanceName(balance, "Ze")

await expect(t).rejects.toThrow("The balance name is not valid")
})

it('Should have id', async ()=> {
const t = usecase.UpdateBalanceName({...balance, id: id}, "Oseias")

await expect(t).rejects.toThrow("Balance Id not found")
})
})

describe('Should delete balance', () => {
let id: string

it("Should have id", async () => {
const t = usecase.DeleteBalance(id)

await expect(t).rejects.toThrow("Id not found")
})
})

92 changes: 92 additions & 0 deletions api/application/balance.usecase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { Balance, BalanceInterface } from "../domain/balance.entity";
import { v4 as uuid } from 'uuid'
import { UserInfo } from "../domain/user.entity";
import BalanceRepository from "../infra/repository/balance.repository";

export class BalanceUseCase implements BalanceInterface {
constructor(private balanceRepo: BalanceRepository){
this.balanceRepo = balanceRepo
}

async CreateBalance(userInfo: UserInfo, balanceName: string, amount: number, description: string): Promise<Balance | Error> {
const newId = uuid();

const verifyParams = BalanceUseCase.validateBalance(userInfo, balanceName, amount)
if (!verifyParams) {
throw Error("Balance invalid")
}

const newBalance: Balance = {
id: newId,
userId: userInfo.id,
balanceName: balanceName,
description: description,
initialValue: amount,
totalValue: amount,
valueUsed: 0
}

const saveDb = await this.balanceRepo.CreateBalanceRepo(newBalance)

return newBalance
}

async GetAllBalances(userInfo: UserInfo): Promise<Balance | Error> {
const getBalances = await this.balanceRepo.GetAllBalances(userInfo)
return getBalances
}

async DeleteBalance(id: string): Promise<boolean | Error> {
if (!id){
throw Error("Id not found")
}

const verifyBalance = await this.balanceRepo.GetBalanceById(id)

if(verifyBalance.valueUsed !== 0){
throw Error("There are linked balances")
}

const deleteRepo = await this.balanceRepo.DeleteBalances(id)
if (deleteRepo) {
return true
}

return false
}


async UpdateBalanceName(balance: Balance, newName: string): Promise<Balance | Error> {
if (newName.length < 3){
throw Error("The balance name is not valid")
}

if (!balance.id){
throw Error("Balance Id not found")
}

const updateName = await this.balanceRepo.UpdateNameBalance(balance, newName)
if (updateName.affectedRows === 1) {
return { ...balance, balanceName: newName}
}

throw Error("Balance name not update")
}

static validateBalance(userInfo: UserInfo, balanceName: string, amount: number): boolean | Error {
if (!userInfo.id){
throw Error("Id not found")
}

if (!balanceName){
throw Error("Balance Name is required")
}

if (!amount){
throw Error("Balance Amount is required")
}
return true

}

}
Loading