Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Add dev to testing#139

Merged
SuitablyMysterious merged 73 commits intotestingfrom
dev
Aug 2, 2025
Merged

Add dev to testing#139
SuitablyMysterious merged 73 commits intotestingfrom
dev

Conversation

@SuitablyMysterious
Copy link
Collaborator

Update testing to allow @SuitablyMysterious to test backend and db on their own to test the api

SuitablyMysterious and others added 30 commits July 7, 2025 18:59
Fixes the error with `DSN.delete()`
update gitignore for binary files
@SuitablyMysterious SuitablyMysterious requested review from a team and Copilot August 2, 2025 12:27
@SuitablyMysterious SuitablyMysterious self-assigned this Aug 2, 2025
@SuitablyMysterious SuitablyMysterious added C - Backend Affects the backend container C - DB Affects the database container L - Docker Affects the use of docker labels Aug 2, 2025
@SuitablyMysterious SuitablyMysterious added L - Python Affects code written in Python S - None Has no impact on security. labels Aug 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces Vue.js frontend scaffolding and backend database user management functionality to enable @SuitablyMysterious to test the backend and database APIs independently.

Key changes:

  • Replaces Flask-based frontend with Vue.js framework and components
  • Adds User class with SQL storage and Casbin integration for user management
  • Updates Docker configuration and database schema to support development testing

Reviewed Changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/frontend/src/*.vue Vue.js components for frontend UI (book search, login, header)
src/frontend/package.json NPM dependencies and build configuration for Vue.js
src/backend/db.py User class implementation with database operations and email validation
src/backend/requirements.in Added email-validator dependency
compose.yaml Updated Docker services, replaced Casdoor with Logto authentication
db-init/1_tables.sql Added users table and changed ID types from BIGINT to UUID
launch.sh New script for environment setup and Docker management
Comments suppressed due to low confidence (1)

self.forename = forename
self.surname = surname
self.student_id = student_id
self.uuid = str(uuid.uuid4())
Copy link

Copilot AI Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using uuid.uuid4() is redundant when uuid is already imported. Use uuid4() directly instead of uuid.uuid4().

Suggested change
self.uuid = str(uuid.uuid4())
self.uuid = str(uuid4())

Copilot uses AI. Check for mistakes.
self.role = role
def SQLStore(self):
try:
sendSQLCommand(
Copy link

Copilot AI Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sendSQLCommand call is missing the 'params' parameter that should contain the SQL parameters tuple, but the function signature expects it.

Copilot uses AI. Check for mistakes.
field = valid_columns[field]

if field == 'userID':
user = User(sendSQLCommand(
Copy link

Copilot AI Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The User constructor expects individual parameters (forename, surname, student_id, email, role) but sendSQLCommand returns a tuple. You need to unpack the result or handle the tuple properly.

Suggested change
user = User(sendSQLCommand(
user = User(*sendSQLCommand(

Copilot uses AI. Check for mistakes.
id UUID PRIMARY KEY,
forename TEXT NOT NULL,
surname TEXT NOT NULL,
student_id INTEGER NOT NULL
Copy link

Copilot AI Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comma after 'student_id INTEGER NOT NULL' which will cause a SQL syntax error.

Suggested change
student_id INTEGER NOT NULL
student_id INTEGER NOT NULL,

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +58
if (type === 'id') {
url = 'http://localhost:8000/Book/getByID'
params = { id: this.query.id }

} else if (type === 'isbn') {
Copy link

Copilot AI Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code checks for 'id' type but there is no corresponding input field or query parameter for 'id' in the template, and the query object doesn't have an 'id' property.

Suggested change
if (type === 'id') {
url = 'http://localhost:8000/Book/getByID'
params = { id: this.query.id }
} else if (type === 'isbn') {
if (type === 'isbn') {

Copilot uses AI. Check for mistakes.

field = valid_columns[field]

if field == 'userID':
Copy link

Copilot AI Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks for 'userID' but the valid_columns mapping shows 'userID' maps to 'student_id', so this condition will never be true after the field is mapped.

Suggested change
if field == 'userID':
if field == 'student_id':

Copilot uses AI. Check for mistakes.
@SuitablyMysterious SuitablyMysterious merged commit 263e98b into testing Aug 2, 2025
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

C - Backend Affects the backend container C - DB Affects the database container L - Docker Affects the use of docker L - Python Affects code written in Python S - None Has no impact on security.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants