Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Arturo Montejo Ráez
/
WBT2425_0
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
20
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
75409e57
authored
Apr 15, 2025
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
catch paths
parent
cec35a4d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
66 deletions
fastapi/main.py
fastapi/webapp.sql
react/src/config-prod.js
react/src/config.js
fastapi/main.py
View file @
75409e57
...
@@ -26,15 +26,6 @@ app.add_middleware(
...
@@ -26,15 +26,6 @@ app.add_middleware(
allow_headers
=
[
"*"
],
# Allow all headers
allow_headers
=
[
"*"
],
# Allow all headers
)
)
# Redirect root URL to the public index.html
@app.get
(
"/"
)
async
def
redirect_root
():
return
RedirectResponse
(
"/public/index.html"
)
@app.get
(
"/public/"
)
async
def
redirect_public
():
return
RedirectResponse
(
"/public/index.html"
)
# User CRUD Operations
# User CRUD Operations
@app.post
(
"/user/"
,
response_model
=
user_schemas
.
User
)
@app.post
(
"/user/"
,
response_model
=
user_schemas
.
User
)
def
create_user
(
user
:
user_schemas
.
UserCreate
,
db
:
Session
=
Depends
(
get_db
)):
def
create_user
(
user
:
user_schemas
.
UserCreate
,
db
:
Session
=
Depends
(
get_db
)):
...
@@ -115,3 +106,8 @@ from fastapi.security import OAuth2PasswordRequestForm
...
@@ -115,3 +106,8 @@ from fastapi.security import OAuth2PasswordRequestForm
def
login
(
form_data
:
OAuth2PasswordRequestForm
=
Depends
(),
db
:
Session
=
Depends
(
get_db
)):
def
login
(
form_data
:
OAuth2PasswordRequestForm
=
Depends
(),
db
:
Session
=
Depends
(
get_db
)):
return
login_user
(
db
,
form_data
.
username
,
form_data
.
password
)
return
login_user
(
db
,
form_data
.
username
,
form_data
.
password
)
# Redirect root URL to the public index.html
@app.route
(
"/{full_path:path}"
)
async
def
catch_all
(
full_path
:
str
):
print
(
"full_path: "
+
full_path
)
return
RedirectResponse
(
"/public/index.html"
)
\ No newline at end of file
fastapi/webapp.sql
View file @
75409e57
...
@@ -27,11 +27,15 @@ SET time_zone = "+00:00";
...
@@ -27,11 +27,15 @@ SET time_zone = "+00:00";
-- Estructura de tabla para la tabla `book`
-- Estructura de tabla para la tabla `book`
--
--
DROP
TABLE
IF
EXISTS
`book`
;
CREATE
TABLE
`book`
(
CREATE
TABLE
`book`
(
`id`
int
(
10
)
UNSIGNED
NOT
NULL
,
`id`
int
(
10
)
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`owner`
int
(
10
)
UNSIGNED
NOT
NULL
,
`owner`
int
(
10
)
UNSIGNED
NOT
NULL
,
`title`
varchar
(
80
)
NOT
NULL
,
`title`
varchar
(
80
)
NOT
NULL
,
`author`
varchar
(
80
)
DEFAULT
NULL
`author`
varchar
(
80
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
),
KEY
`owner`
(
`owner`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
;
--
--
...
@@ -51,12 +55,15 @@ INSERT INTO `book` (`id`, `owner`, `title`, `author`) VALUES
...
@@ -51,12 +55,15 @@ INSERT INTO `book` (`id`, `owner`, `title`, `author`) VALUES
-- Estructura de tabla para la tabla `loan`
-- Estructura de tabla para la tabla `loan`
--
--
DROP
TABLE
IF
EXISTS
`loan`
;
CREATE
TABLE
`loan`
(
CREATE
TABLE
`loan`
(
`id_user`
int
(
10
)
UNSIGNED
NOT
NULL
,
`id_user`
int
(
10
)
UNSIGNED
NOT
NULL
,
`id_book`
int
(
10
)
UNSIGNED
NOT
NULL
,
`id_book`
int
(
10
)
UNSIGNED
NOT
NULL
,
`status`
enum
(
'available'
,
'on loan'
,
'reserved'
)
NOT
NULL
DEFAULT
'available'
,
`status`
enum
(
'available'
,
'on loan'
,
'reserved'
)
NOT
NULL
DEFAULT
'available'
,
`start`
date
DEFAULT
NULL
,
`start`
date
DEFAULT
NULL
,
`end`
date
DEFAULT
NULL
`end`
date
DEFAULT
NULL
,
UNIQUE
KEY
`id_user`
(
`id_user`
,
`id_book`
,
`start`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
;
--
--
...
@@ -76,11 +83,15 @@ INSERT INTO `loan` (`id_user`, `id_book`, `status`, `start`, `end`) VALUES
...
@@ -76,11 +83,15 @@ INSERT INTO `loan` (`id_user`, `id_book`, `status`, `start`, `end`) VALUES
-- Estructura de tabla para la tabla `user`
-- Estructura de tabla para la tabla `user`
--
--
DROP
TABLE
IF
EXISTS
`user`
;
CREATE
TABLE
`user`
(
CREATE
TABLE
`user`
(
`id`
int
(
10
)
UNSIGNED
NOT
NULL
,
`id`
int
(
10
)
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`email`
varchar
(
50
)
NOT
NULL
,
`email`
varchar
(
50
)
NOT
NULL
,
`password`
varchar
(
256
)
NOT
NULL
,
`password`
varchar
(
256
)
NOT
NULL
,
`role`
tinyint
(
3
)
UNSIGNED
NOT
NULL
DEFAULT
0
`role`
tinyint
(
3
)
UNSIGNED
NOT
NULL
DEFAULT
0
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`email`
(
`email`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
;
--
--
...
@@ -91,46 +102,6 @@ INSERT INTO `user` (`id`, `email`, `password`, `role`) VALUES
...
@@ -91,46 +102,6 @@ INSERT INTO `user` (`id`, `email`, `password`, `role`) VALUES
(
1
,
'arturo@example.com'
,
'$2b$12$tiA9GnLxn2xhGXT7E.hq9uDI/RMWwpyH1FzJGbBgrtgCAAREvYFUe'
,
0
);
(
1
,
'arturo@example.com'
,
'$2b$12$tiA9GnLxn2xhGXT7E.hq9uDI/RMWwpyH1FzJGbBgrtgCAAREvYFUe'
,
0
);
--
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `book`
--
ALTER
TABLE
`book`
ADD
PRIMARY
KEY
(
`id`
),
ADD
KEY
`owner`
(
`owner`
);
--
-- Indices de la tabla `loan`
--
ALTER
TABLE
`loan`
ADD
UNIQUE
KEY
`id_user`
(
`id_user`
,
`id_book`
,
`start`
);
--
-- Indices de la tabla `user`
--
ALTER
TABLE
`user`
ADD
PRIMARY
KEY
(
`id`
),
ADD
UNIQUE
KEY
`email`
(
`email`
);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `book`
--
ALTER
TABLE
`book`
MODIFY
`id`
int
(
10
)
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
6
;
--
-- AUTO_INCREMENT de la tabla `user`
--
ALTER
TABLE
`user`
MODIFY
`id`
int
(
10
)
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
2
;
--
-- Restricciones para tablas volcadas
-- Restricciones para tablas volcadas
--
--
...
...
react/src/config-prod.js
deleted
100644 → 0
View file @
cec35a4d
const
config
=
{
apiBaseUrl
:
'https://wbt2425-0-amr-aydfbbc2ftfzeset.spaincentral-01.azurewebsites.net'
,
};
export
default
config
;
\ No newline at end of file
react/src/config.js
deleted
100644 → 0
View file @
cec35a4d
const
config
=
{
apiBaseUrl
:
'http://localhost:8000'
,
};
export
default
config
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment