Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file includes global variables that will be available inside your project
# 1. In the front end code you can access this variables like this: console.log(import.meta.env.VARIABLE_NAME)
# 1. In the back end code you access the variable by importing os and then typing print(os.getenv('VARIABLE_NAME'))

# Back-End Variables
DATABASE_URL=postgres://gitpod:postgres@localhost:5432/example
FLASK_APP_KEY="any key works"
FLASK_APP=src/app.py
FLASK_DEBUG=1
DEBUG=TRUE


# Front-End Variables
VITE_BASENAME=/
VITE_BACKEND_URL=http://127.0.0.1:3001
BACKEND_URL=http://127.0.0.1:3001
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ FLASK_APP=src/app.py
FLASK_DEBUG=1
DEBUG=TRUE


# Front-End Variables
VITE_BASENAME=/
#VITE_BACKEND_URL=
VITE_BACKEND_URL=http://127.0.0.1:3001
BACKEND_URL=http://127.0.0.1:3001
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dist/*
!.gitkeep
!.htaccess
!.eslintrc
!.env.example
!.env
.now

# backend stuff
Expand All @@ -80,3 +80,4 @@ database.database
database.db
diagram.png
__pycache__/
.env
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
},
"[javascriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
}
},
"liveServer.settings.port": 5501
}
4 changes: 3 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ verify_ssl = true

[packages]
flask = "*"
flask-sqlalchemy = "*"
flask-migrate = "*"
flask-swagger = "*"
psycopg2-binary = "*"
Expand All @@ -20,6 +19,8 @@ typing-extensions = "*"
flask-jwt-extended = "==4.6.0"
wtforms = "==3.1.2"
sqlalchemy = "*"
flask-sqlalchemy = "*"
flask-bcrypt = "*"

[requires]
python_version = "3.13"
Expand All @@ -34,3 +35,4 @@ downgrade="flask db downgrade"
insert-test-data="flask insert-test-data"
reset_db="bash ./docs/assets/reset_migrations.bash"
deploy="echo 'Please follow this 3 steps to deploy: https://github.com/4GeeksAcademy/flask-rest-hello/blob/master/README.md#deploy-your-website-to-heroku' "

561 changes: 336 additions & 225 deletions Pipfile.lock

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,15 @@ This boilerplate it's 100% read to deploy with Render.com and Heroku in a matter
This template was built as part of the 4Geeks Academy [Coding Bootcamp](https://4geeksacademy.com/us/coding-bootcamp) by [Alejandro Sanchez](https://twitter.com/alesanchezr) and many other contributors. Find out more about our [Full Stack Developer Course](https://4geeksacademy.com/us/coding-bootcamps/part-time-full-stack-developer), and [Data Science Bootcamp](https://4geeksacademy.com/us/coding-bootcamps/datascience-machine-learning).

You can find other templates and resources like this at the [school github page](https://github.com/4geeksacademy/).


##-------------------------------------------------------------

## Pasos para correr el backend projecto kevin.michelle.gia

- git clone URL_DEL_REPO
- cd final.project.kevin.michelle.gia
- pipenv install
- pipenv run flask --app src/app.py db upgrade
- cd src
- pipenv run python app.py
10 changes: 10 additions & 0 deletions Workshop API/opencollection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
opencollection: 1.0.0

info:
name: Workshop API
bundled: false
extensions:
bruno:
ignore:
- node_modules
- .git
32 changes: 18 additions & 14 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<!DOCTYPE html>
<html class="h-100">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<title>Hello Rigo with React + Flux + Context.js</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<link rel="shortcut icon" href="./4geeks.ico"></head>
<body class="h-100">
<div id="app" class="h-100"></div>
<script type="text/javascript" src="./bundle.js"></script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="icon" href="/4geeks.ico" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello Rigo</title>
<script type="module" crossorigin src="/assets/index-36f23665.js"></script>
<link rel="stylesheet" href="/assets/index-01ef5c0b.css">
</head>
<body>
<div id="root"></div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="icon" href="/4geeks.ico" />
<link rel="icon" type="icon" href="\src\front\assets\img\little_logo.png" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello Rigo</title>
<title>Workshop Manager</title>
</head>
<body>
<div id="root"></div>
Expand Down
35 changes: 0 additions & 35 deletions migrations/versions/0763d677d453_.py

This file was deleted.

177 changes: 177 additions & 0 deletions migrations/versions/6e228a5724e1_initial_sqlite_database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
"""initial sqlite database

Revision ID: 6e228a5724e1
Revises:
Create Date: 2026-07-03 13:08:30.636198

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '6e228a5724e1'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('workshops',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('company_name', sa.String(length=120), nullable=False),
sa.Column('cif', sa.String(length=50), nullable=False),
sa.Column('phone', sa.String(length=20), nullable=False),
sa.Column('email', sa.String(length=120), nullable=False),
sa.Column('address', sa.String(length=200), nullable=True),
sa.Column('city', sa.String(length=80), nullable=True),
sa.Column('postal_code', sa.String(length=20), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('cif'),
sa.UniqueConstraint('email')
)
op.create_table('customers',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('first_name', sa.String(length=80), nullable=False),
sa.Column('last_name', sa.String(length=120), nullable=False),
sa.Column('dni', sa.String(length=20), nullable=False),
sa.Column('driving_license', sa.String(length=20), nullable=False),
sa.Column('phone', sa.String(length=20), nullable=False),
sa.Column('email', sa.String(length=120), nullable=True),
sa.Column('address', sa.String(length=200), nullable=True),
sa.Column('workshop_id', sa.Integer(), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['workshop_id'], ['workshops.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('dni'),
sa.UniqueConstraint('driving_license')
)
op.create_table('employees',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('first_name', sa.String(length=80), nullable=False),
sa.Column('last_name', sa.String(length=120), nullable=False),
sa.Column('dni', sa.String(length=20), nullable=False),
sa.Column('phone', sa.String(length=20), nullable=False),
sa.Column('address', sa.String(length=200), nullable=True),
sa.Column('city', sa.String(length=80), nullable=True),
sa.Column('postal_code', sa.String(length=20), nullable=True),
sa.Column('role', sa.String(length=20), nullable=False),
sa.Column('job_position', sa.String(length=80), nullable=True),
sa.Column('specialty', sa.String(length=120), nullable=True),
sa.Column('workshop_id', sa.Integer(), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['workshop_id'], ['workshops.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('dni')
)
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sa.String(length=120), nullable=False),
sa.Column('password_hash', sa.String(length=255), nullable=False),
sa.Column('employee_id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['employee_id'], ['employees.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email'),
sa.UniqueConstraint('employee_id')
)
op.create_table('vehicles',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('plate', sa.String(length=20), nullable=False),
sa.Column('vin', sa.String(length=50), nullable=True),
sa.Column('brand', sa.String(length=80), nullable=False),
sa.Column('model', sa.String(length=80), nullable=False),
sa.Column('version', sa.String(length=80), nullable=True),
sa.Column('year', sa.Integer(), nullable=True),
sa.Column('fuel_type', sa.String(length=30), nullable=False),
sa.Column('power_hp', sa.Integer(), nullable=True),
sa.Column('engine_cc', sa.Integer(), nullable=True),
sa.Column('color', sa.String(length=50), nullable=True),
sa.Column('mileage', sa.Integer(), nullable=False),
sa.Column('first_registration_date', sa.Date(), nullable=True),
sa.Column('customer_id', sa.Integer(), nullable=False),
sa.Column('workshop_id', sa.Integer(), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['customer_id'], ['customers.id'], ),
sa.ForeignKeyConstraint(['workshop_id'], ['workshops.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('plate'),
sa.UniqueConstraint('vin')
)
op.create_table('password_reset_tokens',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('token_hash', sa.String(length=255), nullable=False),
sa.Column('expires_at', sa.DateTime(), nullable=False),
sa.Column('used_at', sa.DateTime(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('token_hash')
)
op.create_table('services',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=120), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('service_type', sa.String(length=50), nullable=False),
sa.Column('status', sa.String(length=30), nullable=False),
sa.Column('priority', sa.String(length=20), nullable=False),
sa.Column('entry_mileage', sa.Integer(), nullable=True),
sa.Column('start_date', sa.DateTime(), nullable=True),
sa.Column('end_date', sa.DateTime(), nullable=True),
sa.Column('observations', sa.Text(), nullable=True),
sa.Column('workshop_id', sa.Integer(), nullable=False),
sa.Column('customer_id', sa.Integer(), nullable=False),
sa.Column('vehicle_id', sa.Integer(), nullable=False),
sa.Column('employee_id', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['customer_id'], ['customers.id'], ),
sa.ForeignKeyConstraint(['employee_id'], ['employees.id'], ),
sa.ForeignKeyConstraint(['vehicle_id'], ['vehicles.id'], ),
sa.ForeignKeyConstraint(['workshop_id'], ['workshops.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('service_comments',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('comment', sa.Text(), nullable=False),
sa.Column('comment_type', sa.String(length=50), nullable=False),
sa.Column('service_id', sa.Integer(), nullable=False),
sa.Column('employee_id', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['employee_id'], ['employees.id'], ),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('service_status_logs',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('service_id', sa.Integer(), nullable=False),
sa.Column('from_status', sa.String(length=30), nullable=True),
sa.Column('to_status', sa.String(length=30), nullable=False),
sa.Column('employee_id', sa.Integer(), nullable=True),
sa.Column('note', sa.Text(), nullable=True),
sa.Column('changed_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['employee_id'], ['employees.id'], ),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('service_status_logs')
op.drop_table('service_comments')
op.drop_table('services')
op.drop_table('password_reset_tokens')
op.drop_table('vehicles')
op.drop_table('users')
op.drop_table('employees')
op.drop_table('customers')
op.drop_table('workshops')
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""add image fields to service comments

Revision ID: 6e6483e4f080
Revises: 6e228a5724e1
Create Date: 2026-07-06 12:21:39.911589

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '6e6483e4f080'
down_revision = '6e228a5724e1'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('service_comments', schema=None) as batch_op:
batch_op.add_column(sa.Column('image_url', sa.String(length=500), nullable=True))
batch_op.add_column(sa.Column('image_public_id', sa.String(length=255), nullable=True))

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('service_comments', schema=None) as batch_op:
batch_op.drop_column('image_public_id')
batch_op.drop_column('image_url')

# ### end Alembic commands ###
Loading