Skip to content

Commit

Permalink
chore(api): some additions for easier frontend dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mmtftr committed May 15, 2024
1 parent 4098d00 commit 242b12e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend/src/services/api/semanticBrowseSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type AuthToken = {
};

/**
* @example {"id":1,"username":"takoyaki_lover","name":"Takoyaki Lover","bio":"I love takoyaki!","followersCount":100,"gender":"unknown","profilePicture":"https://images.unsplash.com/photo-1633790450512-98e68a55ef15?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=brunno-tozzo-GAIC2WHxm5A-unsplash.jpg&w=640","diets":["keto"],"recipeCount":10,"bookmarks":[{"id":1,"name":"My Takoyaki Recipe","description":"A delicious takoyaki recipe that I learned from my grandmother.","cookTime":30,"images":["http://commons.wikimedia.org/wiki/Special:FilePath/Takoyaki%20by%20yomi955.jpg"],"rating":4.5,"dish":{"id":"http://www.wikidata.org/entity/Q905527","name":"takoyaki"}}],"recipes":[{"id":1,"name":"My Takoyaki Recipe","description":"A delicious takoyaki recipe that I learned from my grandmother.","cookTime":30,"images":["http://commons.wikimedia.org/wiki/Special:FilePath/Takoyaki%20by%20yomi955.jpg"],"rating":4.5,"dish":{"id":"http://www.wikidata.org/entity/Q905527","name":"takoyaki"}}]}
* @example {"id":1,"username":"takoyaki_lover","name":"Takoyaki Lover","bio":"I love takoyaki!","followersCount":100,"gender":"unknown","profilePicture":"https://images.unsplash.com/photo-1633790450512-98e68a55ef15?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=brunno-tozzo-GAIC2WHxm5A-unsplash.jpg&w=640","diets":["keto"],"selfFollowing":true,"recipeCount":10,"bookmarks":[{"id":1,"name":"My Takoyaki Recipe","description":"A delicious takoyaki recipe that I learned from my grandmother.","cookTime":30,"images":["http://commons.wikimedia.org/wiki/Special:FilePath/Takoyaki%20by%20yomi955.jpg"],"rating":4.5,"dish":{"id":"http://www.wikidata.org/entity/Q905527","name":"takoyaki"}}],"recipes":[{"id":1,"name":"My Takoyaki Recipe","description":"A delicious takoyaki recipe that I learned from my grandmother.","cookTime":30,"images":["http://commons.wikimedia.org/wiki/Special:FilePath/Takoyaki%20by%20yomi955.jpg"],"rating":4.5,"dish":{"id":"http://www.wikidata.org/entity/Q905527","name":"takoyaki"}}]}
*/
export type UserProfile = {
id?: number;
Expand All @@ -38,6 +38,7 @@ export type UserProfile = {
profilePicture?: string;
diets?: string[];
recipeCount?: number;
selfFollowing?: boolean;
/**
* Only available when querying the current user's profile.
*/
Expand All @@ -46,7 +47,7 @@ export type UserProfile = {
};

/**
* @example {"id":1,"username":"takoyaki_lover","name":"Takoyaki Lover","followersCount":100,"profilePicture":"http://commons.wikimedia.org/wiki/Special:FilePath/Takoyaki%20by%20yomi955.jpg","recipeCount":10,"avgRating":4.5}
* @example {"id":1,"username":"takoyaki_lover","name":"Takoyaki Lover","followersCount":100,"profilePicture":"http://commons.wikimedia.org/wiki/Special:FilePath/Takoyaki%20by%20yomi955.jpg","recipeCount":10,"avgRating":4.5,"selfFollowing":false}
*/
export type UserSummary = {
id: number;
Expand All @@ -57,6 +58,7 @@ export type UserSummary = {
* @format uri
*/
profilePicture: string;
selfFollowing?: boolean;
recipeCount: number;
/**
* @format float
Expand Down Expand Up @@ -111,6 +113,7 @@ export type RecipeSummary = {
*/
cookTime: number;
images: string[];
selfBookmarked?: boolean;
/**
* @format float
*/
Expand Down Expand Up @@ -139,6 +142,7 @@ export type RecipeDetails = {
allergens: string[];
cuisine?: CuisineSummary;
dish: DishSummary;
selfBookmarked?: boolean;
/**
* @format float
*/
Expand Down Expand Up @@ -187,7 +191,7 @@ export type DishSummary = {
export type Comment = {
id: number;
author: UserSummary;
recipeId?: number;
recipeId: number;
upvoteCount: number;
content: string;
hasSelfUpvoted: boolean;
Expand Down
10 changes: 10 additions & 0 deletions swagger/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,8 @@ components:
type: string
recipeCount:
type: integer
selfFollowing:
type: boolean
bookmarks:
type: array
description: Only available when querying the current user's profile.
Expand All @@ -1027,6 +1029,7 @@ components:
gender: unknown
profilePicture: "https://images.unsplash.com/photo-1633790450512-98e68a55ef15?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=brunno-tozzo-GAIC2WHxm5A-unsplash.jpg&w=640"
diets: ["keto"]
selfFollowing: true
recipeCount: 10
bookmarks:
- id: 1
Expand Down Expand Up @@ -1072,6 +1075,8 @@ components:
profilePicture:
type: string
format: uri
selfFollowing:
type: boolean
recipeCount:
type: integer
avgRating:
Expand All @@ -1085,6 +1090,7 @@ components:
profilePicture: "http://commons.wikimedia.org/wiki/Special:FilePath/Takoyaki%20by%20yomi955.jpg"
recipeCount: 10
avgRating: 4.5
selfFollowing: false

DishDetails:
type: object
Expand Down Expand Up @@ -1183,6 +1189,8 @@ components:
items:
type: string
format: uri
selfBookmarked:
type: boolean
avgRating:
type: number
format: float
Expand Down Expand Up @@ -1269,6 +1277,8 @@ components:
$ref: "#/components/schemas/CuisineSummary"
dish:
$ref: "#/components/schemas/DishSummary"
selfBookmarked:
type: boolean
avgRating:
type: number
format: float
Expand Down

0 comments on commit 242b12e

Please sign in to comment.