Add add function placeholder

This commit is contained in:
2026-11-04 20:56:41 +11:00
parent 0fe57174f1
commit b292ab2de9
4 changed files with 44 additions and 12 deletions
+1
View File
@@ -13,6 +13,7 @@ dependencies = [
[project.scripts] [project.scripts]
cs50-final-project = "cs50_final_project:main" cs50-final-project = "cs50_final_project:main"
start = "cs50_final_project.main:app"
[build-system] [build-system]
requires = ["uv_build>=0.12.5,<0.13.0"] requires = ["uv_build>=0.12.5,<0.13.0"]
+1 -1
View File
@@ -2,7 +2,7 @@ import sqlite3
import typer import typer
from .helpers import create_db from cs50_final_project.helpers import create_db
def db_init() -> None: def db_init() -> None:
+8 -8
View File
@@ -9,12 +9,12 @@ def create_cursor(conn):
def create_db(conn): def create_db(conn):
cursor = create_cursor(conn) cursor = create_cursor(conn)
cursor.execute(""" cursor.execute("""
CREATE TABLE IF NOT EXISTS events CREATE TABLE IF NOT EXISTS events(
id INTEGER PRIMARY KEY AUTOINCREMENT id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL name TEXT NOT NULL,
description TEXT description TEXT,
start_time DATETIME NOT NULL start_time DATETIME NOT NULL,
length INT NOT NULL length INT NOT NULL,
all_day BOOL NOT NULL all_day BOOL NOT NULL,
date_created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP date_created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
"""); )""");
+34 -3
View File
@@ -1,6 +1,37 @@
import sqlite3
import typer import typer
from .db import db_init from cs50_final_project.db import db_init
app = typer.Typer(help="Calendar Clash")
@app.command()
def setup():
"""Begin the application by creating the events database if this is the first time running."""
typer.echo("Setting up the database")
db_init()
typer.echo("Events Database successfully created")
@app.command()
def say():
print("hello")
@app.command()
def add():
name = input("Event Name: ")
day = input("Day of Event: ")
time = input("Time of Event: ")
length = input("Length of Event: ")
description = input("Description of Event: ")
print(name)
print(day)
print(time)
print(length)
print(description)
if __name__ == "__main__":
app()