Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
61ffbd6
Proje altyapısı
KursaDSc May 6, 2025
e3550c9
Main menu tamamlandı
KursaDSc May 6, 2025
25af92b
menu tekrar duzenlendi
KursaDSc May 6, 2025
ead051f
update
KursaDSc May 7, 2025
2bd6640
update
KursaDSc May 7, 2025
0911cab
update
KursaDSc May 7, 2025
85cd1d3
Create lutfu
MLAcikgoz May 7, 2025
5ea301b
Update lutfu
MLAcikgoz May 7, 2025
903816a
mustafa 07.05 - 18:09
mustaphahaybat May 7, 2025
2a0200c
mustafa
mustaphahaybat May 7, 2025
e278363
mustafa
mustaphahaybat May 7, 2025
df91f9f
m
mustaphahaybat May 7, 2025
f8e4e22
Update member_transactions.py
KursaDSc May 7, 2025
d9e431f
up
KursaDSc May 8, 2025
cb820cd
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
KursaDSc May 8, 2025
8a0d598
mustafa (kitap verme ve alma hariç)
mustaphahaybat May 8, 2025
63df3f0
x
KursaDSc May 8, 2025
b1cb494
11
mustaphahaybat May 8, 2025
532b958
22
mustaphahaybat May 8, 2025
9cec040
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
mustaphahaybat May 8, 2025
346ea5f
y
KursaDSc May 8, 2025
647c5a1
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
KursaDSc May 8, 2025
b0024e0
Update book_transactions.py
FurkanBilal May 8, 2025
dbd8bf8
Update book_transactions.py
FurkanBilal May 8, 2025
27d4634
Update book_transactions.py
FurkanBilal May 8, 2025
aa4b477
member_transactions güncelleme
mustaphahaybat May 8, 2025
fc92c4b
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
mustaphahaybat May 8, 2025
06724b6
harf hatası düzeltildi
mustaphahaybat May 8, 2025
34d77a9
Ali_4.week
alibuyukgural May 8, 2025
bd347f7
Update data_io.py
MLAcikgoz May 9, 2025
48e5e73
Update data_io.py
MLAcikgoz May 9, 2025
a213ed6
.
KursaDSc May 9, 2025
9f19a46
data_io
KursaDSc May 9, 2025
3f8e6fc
revize
mustaphahaybat May 9, 2025
d78608b
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
mustaphahaybat May 9, 2025
0da029e
time_utils update
KursaDSc May 9, 2025
abfc607
1
mustaphahaybat May 9, 2025
dab1377
restore 3
mustaphahaybat May 9, 2025
d444b36
Update tracking.py
KursaDSc May 9, 2025
dff9a83
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
alibuyukgural May 9, 2025
08dfdc3
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
alibuyukgural May 9, 2025
4e90d78
Ali
alibuyukgural May 9, 2025
d05d8ac
Furkan
FurkanBilal May 9, 2025
abbe934
revize 4
mustaphahaybat May 9, 2025
0919038
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
mustaphahaybat May 9, 2025
da0b8db
track_loan update
KursaDSc May 9, 2025
510ad06
x
KursaDSc May 9, 2025
bc46dbd
memeber search revize
mustaphahaybat May 9, 2025
1083476
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
mustaphahaybat May 9, 2025
4ab583d
members
KursaDSc May 9, 2025
63dee42
lend_book
KursaDSc May 9, 2025
d9ac090
1
mustaphahaybat May 9, 2025
5ba415d
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
mustaphahaybat May 9, 2025
58ef7f9
1
mustaphahaybat May 9, 2025
a9f4a3b
yordu
mustaphahaybat May 9, 2025
b28cef3
eğlendirdi
mustaphahaybat May 9, 2025
52170df
Update books.json
KursaDSc May 9, 2025
3107602
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
KursaDSc May 9, 2025
7a346ba
last_update
KursaDSc May 9, 2025
ec5b9ec
update
KursaDSc May 9, 2025
4342b04
v
alibuyukgural May 10, 2025
d0767da
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
alibuyukgural May 10, 2025
01ef83f
1
mustaphahaybat May 10, 2025
68c03d6
Merge branch 'main' of https://github.com/KursaDSc/Python_Modul_Week_4
mustaphahaybat May 10, 2025
83b4848
.
KursaDSc May 10, 2025
de23ecd
Add .gitignore to ignore __pycache__ and compiled files
KursaDSc May 10, 2025
2c03e02
Add .gitignore to ignore __pycache__ and compiled files
KursaDSc May 10, 2025
1f58df0
Update .gitignore
KursaDSc May 10, 2025
ace15e7
Update .gitignore
KursaDSc May 10, 2025
0259c33
Temizlik: .pyc ve __pycache__ dosyaları ignore edildi
KursaDSc May 10, 2025
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
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
data/book.json
data/kitap _backup.json

# Tüm pyc, pyo, pyd dosyalarını ignore et
*.py[cod]

# __pycache__ klasörlerini ignore et (her seviyede)
__pycache__/
**/__pycache__/

# VS Code settings
.vscode/

# Mac system files
.DS_Store
68 changes: 68 additions & 0 deletions Project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
✅ Kürşad (Takım Lideri)
Sorumlu Olduğun Dosyalar:

main.py
core/menu.py
core/routing.py
core/book_handlers.py
core/member_handlers.py

🧭 Proje akışı, yönlendirme, handler mantığı ve kullanıcı arayüzünün (CLI) temelinden sorumlu.

👤 Furkan – Kitap İşlemleri
Dosyalar:

book_transactions.py
data/books.json

Görevler:

- Kitap ekleme, silme, güncelleme, arama, listeleme

- Kitap verileriyle ilgili book_transactions.py fonksiyonlarını yazmak

- JSON veri dosyasıyla etkileşim için data_io.py’ye veri çağrısı yapmak

👤 Mustafa – Üye (Member) İşlemleri
Dosyalar:

member_transactions.py
data/members.json

Görevler:

- Üye ekleme, silme, arama, listeleme

- Kitap ödünç verme / iade işlemlerini member_transactions.py içinde gerçekleştirmek

- Üye bilgilerini işlemek için data_io.py ile veri alışverişi yapmak

👤 Ali – Takip Sistemi ve Zaman İşlemleri
Dosyalar:

tracking.py
data/tracking.json
core/time_utils.py

Görevler:

- Ödünç alınan kitapların izlenmesi (kim aldı, ne zaman, vs.)

- Geciken kitapların takibi ve listeleme

- Tarih ve zaman hesaplamaları (geç kaldı mı? kaç gün kaldı?)

- time_utils.py içinde gerekli tarih fonksiyonlarını yazmak

👤 Mehmet Lütfi – Ortak JSON Veri Yönetimi
Dosyalar:

core/data_io.py

Görevler:

- Tüm JSON veri dosyalarıyla okuma/yazma işlemleri

- book_transactions, member_transactions, tracking gibi modüllerin ihtiyaç duyduğu genel veri erişim fonksiyonlarını yazmak

- Gerekirse yedekleme veya ilk veri oluşturma (örneğin kitap_backup.json)
42 changes: 42 additions & 0 deletions book_transactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import core.data_io as di

#kitaplarin kayitli oldugu dosya
books_file = 'data/books.json'

#kitap ekleme
def add_book(barcode, title , publisher, author, status):
books = di.read_json(books_file)
books.append({
'barcode': barcode,
'title': title,
'publisher': publisher,
'author': author,
'status': status
})
di.write_json(books_file, books)
#kitap silme
def delete_book(barcode):
books = di.read_json(books_file)
books = [book for book in books if book['barcode'] != barcode]
di.write_json(books_file, books)
#kitap silme
def search_book(search_term):
books = di.read_json(books_file)
results = []
for book in books:
if (search_term.lower() in book['title'].lower() or
search_term.lower() in book['author'].lower() or
search_term.lower() in book['publisher'].lower()):
results.append(book)
return results
#kitaplari listeleme
def get_all_books():
books = di.read_json(books_file)
return books
#kitap durumunu kontrol etme
def is_book_available(barcode):
books = di.read_json(books_file)
for book in books:
if book['barcode'] == barcode:
return book['status'] == 'available'
return False
41 changes: 41 additions & 0 deletions core/book_handlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import book_transactions as bt
from core.menu import menu_header, print_details
import book_transactions as bt
from core.utils import show_message

def handle_show_books():
menu_header("📚 Kütüphanedeki Kitaplar")
books = bt.get_all_books()
print_details(books)
input("\nDevam etmek için bir tuşa basın...")

def handle_add_book():
menu_header("📚 Yeni Kitap Ekle")

barcode = input("Barkod: ").strip()
title = input("Kitap Adı: ").strip()
publisher = input("Yayınevi: ").strip()
author = input("Yazar: ").strip()
status = "available"

# book_transactions içindeki fonksiyonu çağır
bt.add_book(barcode, title, publisher, author, status)
show_message(f"\n✅ '{title}' başarıyla eklendi.\n")

def handle_search_book():
menu_header("🔍 Kitap Ara")
search_term = input("Aramak istediğiniz kitap/başlık/yazar: ").strip()
results = bt.search_book(search_term)

if results:
print("\n🔎 Arama Sonuçları:")
print_details(results)
else:
print("❌ Aradığınız kriterlere uygun kitap bulunamadı.")
input("\nDevam etmek için bir tuşa basın...")

def handle_delete_book():
menu_header("🗑️ Kitap Sil")
barcode = input("Silmek istediğiniz kitabın barkodu: ").strip()
bt.delete_book(barcode)
show_message("✅ Kitap başarıyla silindi.")
63 changes: 63 additions & 0 deletions core/data_io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import json
import os

#Json dosayasini oku
def read_json(filepath):
if not os.path.exists(filepath):
return [] # Dosya yoksa boş liste döndür
try:
with open(filepath, 'r', encoding='utf-8') as file:
return json.load(file)
except json.JSONDecodeError:
return [] # JSON hataliysa boş liste döndür

#json dosyasina yaz
def write_json(filepath, data):
with open(filepath, 'w', encoding='utf-8') as file:
json.dump(data, file, indent=4, ensure_ascii=False)


# JSON dosyasına veri ekle (liste yapısında ise)
def append_to_json_file(filepath, new_data):
data = read_json(filepath)
if isinstance(data, list):
data.append(new_data)
else:
data = [new_data]
write_json(filepath, data)

# Belirli bir öğeyi (kimlik,tbaslik, isim vs.) sil (liste içindeki sözlük)
#chatgpt`den buldum
def delete_from_json_file(filepath, key, value):
data = read_json(filepath)
if isinstance(data, list):
data = [item for item in data if item.get(key) != value]
write_json(filepath, data)

# Belirli bir öğeyi güncelle (liste içindeki sözlük)
def update_json_item(filepath, key, value, updated_item):
data = read_json(filepath)
if isinstance(data, list):
for i, item in enumerate(data):
if item.get(key) == value:
data[i] = updated_item
break
write_json(filepath, data)

# Belirli öğeyi bul (tek eşleşme bekleniyorsa)
def find_in_json(filepath, key, value):
data = read_json(filepath)
if isinstance(data, list):
for item in data:
if item.get(key) == value:
return item
return None

# Tüm eşleşmeleri döndür (filtreleme)
def filter_json_items(filepath, key, value):
data = read_json(filepath)
if isinstance(data, list):
return [item for item in data if item.get(key) == value]
return []


81 changes: 81 additions & 0 deletions core/member_handlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import member_transactions as mt
from core.menu import menu_header, print_details
from core.utils import show_message
import member_transactions as mt
from tracking import track_loan


def handle_show_members():
menu_header("👥 Kayıtlı Üyeler")
members = mt.get_all_members()
print_details(members)
input("\nDevam etmek için bir tuşa basın...")


def handle_add_member():
menu_header("🆕 Yeni Üyelik")
name = input("Ad Soyad: ").strip()
phone = input("Telefon Numarası: ").strip()
address = input("Adres: ").strip()

mt.add_member(name, phone, address)
show_message("\n✅ Üyelik başarıyla oluşturuldu.")


def handle_search_member():
menu_header("🔍 Üye Arama")
keyword = input("Aranacak isim veya ID: ").strip()
results = mt.search_member(keyword)

if results:
print("\n🔎 Eşleşen Üyeler:")
print_details(results)
else:
print("❌ Üye bulunamadı.")
input("\nDevam etmek için bir tuşa basın...")


def handle_delete_member():
menu_header("🗑️ Üyelik Sil")
member_id = input("Silinecek Üyenin ID'si: ").strip()
mt.delete_member(member_id)
show_message("\n✅ Üyelik başarıyla silindi.")


def handle_loan_book():
menu_header("📕 Kitap Ödünç Ver")
member_id = input("Üye ID: ").strip()
barcode = input("Kitap Barkodu: ").strip()

success = mt.lend_book(member_id, barcode)
if success:
print("\n✅ Kitap başarıyla ödünç verildi.")
else:
print("❌ Kitap şu anda ödünç verilemez.")
input("\nDevam etmek için bir tuşa basın...")


def handle_return_book():
menu_header("📗 Kitap İade")
member_id = input("Üye ID: ").strip()
barcode = input("İade edilecek Kitap Barkodu: ").strip()

success = mt.return_book(member_id, barcode)
if success:
print("\n✅ Kitap iadesi başarıyla yapıldı.")
else:
print("❌ İade işlemi başarısız.")
input("\nDevam etmek için bir tuşa basın...")


def handle_book_tracking():
menu_header("📊 Kitap Takibi")
member_id = input("Üye ID: ").strip()
loans = track_loan(member_id)

if loans:
print("\n📚 Ödünç Alınan Kitaplar:")
print_details(loans)
else:
print("ℹ️ Bu üyenin aktif ödünç aldığı kitap bulunmamaktadır.")
input("\nDevam etmek için bir tuşa basın...")
50 changes: 50 additions & 0 deletions core/menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from core.utils import *
from tabulate import tabulate

def menu_header(menu_name, menu_width=30):
clear_screen()
print('-' * menu_width)
print('|' + f"\033[1;33m"+ menu_name.center(menu_width - 2)+f"\033[0m" + '|')
print('-' * menu_width)

def display_menu(title, options, width=50):
menu_header(title, width)
for option in options:
print('|' + ' ' * 10 + option.ljust(width - 12) + '|')
print('-' * width)

def display_main_menu():
main_menu = [
"1 - ÜYELİK İŞLEMLERİ",
"2 - KİTAP İŞLEMLERİ",
"0 - ÇIKIŞ"
]

display_menu("HALK KÜTÜPHANEMİZE HOŞGELDİNİZ", main_menu)

def display_members_menu():
member_menu = [
"1 - ÜYELERİ GÖSTER",
"2 - ÜYELİK EKLE",
"3 - ÜYE ARA",
"4 - ÜYELİK SİL",
"5 - KİTAP ÖDÜNÇ VER",
"6 - KİTAP İADE",
"7 - KİTAP TAKİBİ",
"0 - ÇIKIŞ"
]

display_menu("ÜYELİK İŞLEMLERİ", member_menu)

def display_books_menu():
book_menu = [
"1 - KİTAPLARI GÖSTER",
"2 - KİTAP EKLE",
"3 - KİTAP ARA",
"4 - KİTAP SİL",
"0 - ÇIKIŞ"
]
display_menu("KİTAP İŞLEMLERİ (ENVANTER)", book_menu)

def print_details(data):
print(tabulate(data, headers="keys", tablefmt="fancy_grid"))
Loading