Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema/API Design comment Luke Fanguna #10

Open
Luke-Fanguna opened this issue Nov 12, 2023 · 12 comments
Open

Schema/API Design comment Luke Fanguna #10

Luke-Fanguna opened this issue Nov 12, 2023 · 12 comments

Comments

@Luke-Fanguna
Copy link

This table is quite large and holds a lot of info. I would say to create smaller tables to help spread the information, while keeping it organized. For example, I would create table called route_info that used the "name" as a primary key and hold the information of the route.

public.route (

@Luke-Fanguna
Copy link
Author

this feels like a double entry. Couldn't you just use the user_id to get the author name? or would this be two different people.

author_name text not null,

@Luke-Fanguna
Copy link
Author

Luke-Fanguna commented Nov 12, 2023

this references "users" but the table is not defined anywhere. Possibly a mistake?

constraint review_user_id_fkey foreign key (user_id) references "user" (id)

@Luke-Fanguna
Copy link
Author

i see a lot of "user_id" but i don't see any user table. This makes me think that user_id is just inserted to every table but doesn't have any information linked to it.

user_id integer not null,

@Luke-Fanguna
Copy link
Author

What exactly is "user_test"? Is this a first draft of the users table?

public.user_test (

@Luke-Fanguna
Copy link
Author

Although this is mentioned in the specs, it looks like there is no implementation. If there will not be an implementation, remove from APISpec.md because it can be misleading.

### 1.1. Add Friend - `/socials/{friend}/add` (POST)

@Luke-Fanguna
Copy link
Author

Luke-Fanguna commented Nov 12, 2023

'routes/add' does not match what it says in APISpec.md.

this is what APISpec.md requests:

[
  {
    "name": "string",
    "date_added": "string",
    "user_added": "string",
    "location": "string",
    "coordinates": [lat, long],
    "length_in_miles": "double",
    "difficulty": "string",
    "activities": "string",
  }
]

but this is what it requests in routes.py:

[
  {
    "name": route_to_add.name,
    "user_id": route_to_add.user_id,
    "location": route_to_add.location,
    "length_in_miles": route_to_add.length,
    "difficulty": route_to_add.difficulty,
    "activities": route_to_add.activities,
    "coords": route_to_add.coordinates,
  }
]

You have to match requests with the APISpec.md because it would be hard for a user to use it if the requests don't match the specs.

Same goes for the return statement. It says returns a boolean when it actually returns "OK"

def post_add_route(route_to_add: Routes):

@Luke-Fanguna
Copy link
Author

Again, the requests do not match with the specs.

```json

@Luke-Fanguna
Copy link
Author

Doesn't match the specs. The /popular endpoint request nothing and returns a list of routes. The json is also formatted weird. It is a list of a json that contains a list that is formatted like a json

[
    {
      [     /* List of routes with the following attributes displayed:

        "name": "string",
        "date_added": "string",
        "user_added": "string",
        "location": "string",
        "coordinates": [lat, long],
        "length_in_miles": "double",
        "difficulty": "string",
        "activities": "string",
        "popularity_index": int,
        "five_star_reviews": int

      ]
    }
]

should be:

[
    {
     /* List of routes with the following attributes displayed:
        "name": "string",
        "date_added": "string",
        "user_added": "string",
        "location": "string",
        "coordinates": [lat, long],
        "length_in_miles": "double",
        "difficulty": "string",
        "activities": "string",
        "popularity_index": int,
        "five_star_reviews": int
    }
]

### 2.3. View Popular Routes - `/routes/popular` (GET)

@Luke-Fanguna
Copy link
Author

Luke-Fanguna commented Nov 12, 2023

This endpoint was renamed to /followers in the code but not in the specs. Should fix that. Also, the same format issue with the return. list of json of list formatted like a json.

### 2.4. View Friends Routes - `/routes/friends` (GET)

@Luke-Fanguna
Copy link
Author

Code does not match the specs. /new was turned into /add and the requests/return is different.

### 3.1. Write New Review - `/reviews/new` (POST)

@Luke-Fanguna
Copy link
Author

Code doesn't match specs. Request/return is not the same.

### 4.1. Add PeepCoins - `/peepcoins/add` (PUT)

@Luke-Fanguna
Copy link
Author

The return in the code is different from the specs.

**Returns**:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant