-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from openrice-canada/feat/photo
feat: menu photo
- Loading branch information
Showing
17 changed files
with
481 additions
and
80 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
export type Photo = { | ||
photo_id: string; | ||
export type ReviewPhoto = { | ||
review_photo_id: string; | ||
photo_category_id: string; | ||
review_id: string; | ||
restaurant_id?: string; | ||
photo_url: string; | ||
active: boolean; | ||
created_at: string; | ||
}; | ||
|
||
export type MenuPhoto = { | ||
menu_photo_id: string; | ||
photo_category_id: string; | ||
review_id?: string; | ||
restaurant_id: string; | ||
photo_url: string; | ||
active: boolean; | ||
created_at: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
import { AxiosApiClientBuilder } from "../axiosIndex"; | ||
import { Photo } from "./PhotoType"; | ||
import { MenuPhoto, ReviewPhoto } from "./PhotoType"; | ||
|
||
const apiClient = new AxiosApiClientBuilder() | ||
.withResourceName("/photo") | ||
.build(); | ||
|
||
export const getReviewPhotos = async ( | ||
restaurantID: string | ||
): Promise<Photo[]> => { | ||
): Promise<ReviewPhoto[]> => { | ||
return apiClient.get("review", { params: { restaurantID } }); | ||
}; | ||
|
||
export const getMenuPhotos = async (restaurantID: string): Promise<Photo[]> => { | ||
export const getMenuPhotos = async ( | ||
restaurantID: string | ||
): Promise<MenuPhoto[]> => { | ||
return apiClient.get("menu", { params: { restaurantID } }); | ||
}; | ||
|
||
export const createMenuPhoto = async ( | ||
imagePrefix: string, | ||
restaurantID: string, | ||
imageName: string, | ||
photoCategory: string | ||
): Promise<MenuPhoto> => { | ||
return apiClient.post( | ||
"", | ||
{ imagePrefix, restaurantID, imageName }, | ||
{ params: { photoCategory } } | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
interface DateInputProps { | ||
label: string; | ||
placeholder: string; | ||
value: string | number; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
type?: React.HTMLInputTypeAttribute; | ||
} | ||
|
||
const DateInput = ({ label, placeholder, value, onChange }: DateInputProps) => { | ||
return ( | ||
<div className="flex flex-col gap-1"> | ||
<label className="text-sm font-semibold">{label}</label> | ||
<input | ||
className="border border-gray-400 rounded-md p-2" | ||
type="date" | ||
placeholder={placeholder} | ||
value={value} | ||
onChange={onChange} | ||
min={new Date().toISOString().split("T")[0]} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DateInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.