Skip to content

Commit

Permalink
Merge 'feature/transactions' into 'dev'.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman505050 committed Nov 19, 2024
2 parents cdd9d3e + 2bfca28 commit b816ff7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/presentation/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
app.register_blueprint(auth_bp, url_prefix="")
app.register_blueprint(admin_bp, url_prefix="/admin")
app.register_blueprint(transactions_bp, url_prefix="/transactions")
app.register_blueprint(operation_api_bp, url_prefix="/api/v1/operation")
app.register_blueprint(category_api_bp, url_prefix="/api/v1/category")
app.register_blueprint(currency_api_bp, url_prefix="/api/v1/currency")
app.register_blueprint(transaction_api_bp, url_prefix="/api/v1/transaction")
app.register_blueprint(operation_api_bp, url_prefix="/api/v1/operations")
app.register_blueprint(category_api_bp, url_prefix="/api/v1/categories")
app.register_blueprint(currency_api_bp, url_prefix="/api/v1/currencies")
app.register_blueprint(transaction_api_bp, url_prefix="/api/v1/transactions")


@app.errorhandler(404)
Expand Down
8 changes: 8 additions & 0 deletions src/presentation/app/static/css/transactions.css
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ tr:last-child td {
border-width: 2px;
}

textarea {
resize: vertical;
height: auto;
min-height: 100px;
max-height: 200px;
width: 100%;
}

@media (max-width: 768px) {
table, thead, tbody, th, td, tr {
display: block;
Expand Down
8 changes: 4 additions & 4 deletions src/presentation/app/static/js/admin/categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function fetchOperations() {
operationTypeSelect.innerHTML = '<option value="" disabled selected>Завантаження...</option>';
operationTypeSelect.disabled = true;

const response = await fetch('/api/v1/operation/autocomplete');
const response = await fetch('/api/v1/operations/autocomplete');
if (!response.ok) {
console.error('Error fetching operation types:', response);
showToast('Помилка завантаження типів категорій', 'error');
Expand All @@ -37,7 +37,7 @@ async function fetchOperations() {

async function createCategory(newCategory, operationType) {
try {
const response = await fetch('/api/v1/category', {
const response = await fetch('/api/v1/categories', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -67,7 +67,7 @@ async function fetchCategories() {
document.getElementById('loaderСontainer').classList.remove('hidden');
document.getElementById('categoriesList').classList.add('hidden');

const response = await fetch('/api/v1/category');
const response = await fetch('/api/v1/categories');
if (!response.ok) {
console.error('Error fetching categories:', response);
showToast('Помилка при завантаженні категорій', 'error');
Expand Down Expand Up @@ -139,7 +139,7 @@ categoryItemsContainer.addEventListener('click', async (event) => {
deleteBtn.classList.add('hidden');

try {
const response = await fetch(`/api/v1/category/${categoryId}`, {
const response = await fetch(`/api/v1/categories/${categoryId}`, {
method: 'DELETE'
});

Expand Down
6 changes: 3 additions & 3 deletions src/presentation/app/static/js/admin/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ operationForm.addEventListener('submit', async (event) => {
const type = document.querySelector('input[name="operationType"]:checked').value;

try {
const response = await fetch('/api/v1/operation', {
const response = await fetch('/api/v1/operations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -46,7 +46,7 @@ async function getOperations() {
document.getElementById('loaderСontainer').classList.remove('hidden');
document.getElementById('operationsList').classList.add('hidden');

const response = await fetch('/api/v1/operation');
const response = await fetch('/api/v1/operations');
if (!response.ok) {
console.error('Error fetching operations:', response);
showToast('Помилка завантаження даних', 'error');
Expand Down Expand Up @@ -101,7 +101,7 @@ operationsList.addEventListener('click', async (event) => {
deleteBtn.classList.add('hidden');

try {
const response = await fetch(`/api/v1/operation/${operationId}`, {
const response = await fetch(`/api/v1/operations/${operationId}`, {
method: 'DELETE'
});

Expand Down
8 changes: 4 additions & 4 deletions src/presentation/app/static/js/create-transaction-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function fetchOperations() {
operationSelect.disabled = true;

try {
const response = await fetch('api/v1/operation/autocomplete');
const response = await fetch('api/v1/operations/autocomplete');
const data = await response.json();

operationSelect.innerHTML = '<option value="">Виберіть операцію</option>';
Expand All @@ -54,7 +54,7 @@ async function fetchCurrencies() {
currencySelect.disabled = true;

try {
const response = await fetch('api/v1/currency/autocomplete');
const response = await fetch('api/v1/currencies/autocomplete');
const data = await response.json();

currencySelect.innerHTML = '<option value="">Виберіть валюту</option>';
Expand All @@ -76,7 +76,7 @@ async function fetchCategories(operationId) {
categorySelect.disabled = true;

try {
const response = await fetch(`api/v1/category/autocomplete?operation_id=${operationId}`);
const response = await fetch(`api/v1/categories/autocomplete?operation_id=${operationId}`);
const data = await response.json();

if (operationSelect.value !== operationId) {
Expand All @@ -101,7 +101,7 @@ async function fetchCategories(operationId) {

async function saveTransaction(transaction) {
try {
const response = await fetch('api/v1/transaction', {
const response = await fetch('api/v1/transactions', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
Expand Down
4 changes: 2 additions & 2 deletions src/presentation/app/static/js/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async function fetchTransactions() {
document.getElementById('loaderContainer').classList.remove('hidden');
document.getElementById('transactionTable').classList.add('hidden');

const response = await fetch('/api/v1/transaction/me');
const response = await fetch('/api/v1/transactions/me');
if (!response.ok) {
console.error('Fetch error:', response);
showToast('Помилка завантаження даних', 'error');
Expand All @@ -27,7 +27,7 @@ async function fetchTransactions() {

async function deleteTransaction(transactionId) {
try {
const response = await fetch(`/api/v1/transaction/${transactionId}`, {
const response = await fetch(`/api/v1/transactions/${transactionId}`, {
method: 'DELETE'
});
if (response.ok) {
Expand Down

0 comments on commit b816ff7

Please sign in to comment.