Fix: Inactive Menu Categories should not show up in sales.
Trying to better cache dockerfile
This commit is contained in:
parent
5d5439ae3b
commit
1c222872d2
|
@ -2,7 +2,7 @@ import uuid
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from operator import and_, or_
|
from operator import and_, or_
|
||||||
from typing import List, Optional
|
from typing import List
|
||||||
|
|
||||||
import barker.schemas.menu_category as schemas
|
import barker.schemas.menu_category as schemas
|
||||||
|
|
||||||
|
@ -115,11 +115,11 @@ def show_blank(
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.MenuCategory])
|
@router.get("/list", response_model=List[schemas.MenuCategory])
|
||||||
def show_list(
|
def show_list(
|
||||||
p: Optional[bool] = None,
|
p: bool = False,
|
||||||
date_: date = Depends(effective_date),
|
date_: date = Depends(effective_date),
|
||||||
user: UserToken = Depends(get_user),
|
user: UserToken = Depends(get_user),
|
||||||
) -> List[schemas.MenuCategory]:
|
) -> List[schemas.MenuCategory]:
|
||||||
if p is not None:
|
if p:
|
||||||
sq = select(distinct(ProductVersion.menu_category_id)).where(
|
sq = select(distinct(ProductVersion.menu_category_id)).where(
|
||||||
and_(
|
and_(
|
||||||
or_(
|
or_(
|
||||||
|
@ -134,7 +134,7 @@ def show_list(
|
||||||
)
|
)
|
||||||
query = (
|
query = (
|
||||||
select(MenuCategory)
|
select(MenuCategory)
|
||||||
.where(MenuCategory.id.in_(sq))
|
.where(MenuCategory.id.in_(sq), MenuCategory.is_active == True) # noqa: E712
|
||||||
.order_by(MenuCategory.sort_order)
|
.order_by(MenuCategory.sort_order)
|
||||||
.order_by(MenuCategory.name)
|
.order_by(MenuCategory.name)
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,8 +8,7 @@ RUN npm install --unsafe-perm && /app/bookie/node_modules/.bin/ng build --prod
|
||||||
FROM python:latest
|
FROM python:latest
|
||||||
LABEL maintainer="Amritanshu <docker@tanshu.com>"
|
LABEL maintainer="Amritanshu <docker@tanshu.com>"
|
||||||
|
|
||||||
COPY --from=builder /app/barker /app
|
ADD https://git.tanshu.com/tanshu/barker/raw/tag/latest/barker/pyproject.toml /app/pyproject.toml
|
||||||
COPY --from=builder /app/frontend /app/frontend
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y locales && \
|
apt-get install -y locales && \
|
||||||
|
@ -19,18 +18,21 @@ RUN apt-get update && \
|
||||||
ENV LANG en_IN
|
ENV LANG en_IN
|
||||||
ENV LC_ALL en_IN
|
ENV LC_ALL en_IN
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install Poetry
|
# Install Poetry
|
||||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | POETRY_HOME=/opt/poetry python && \
|
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | POETRY_HOME=/opt/poetry python && \
|
||||||
cd /usr/local/bin && \
|
cd /usr/local/bin && \
|
||||||
ln -s /opt/poetry/bin/poetry && \
|
ln -s /opt/poetry/bin/poetry && \
|
||||||
poetry config virtualenvs.create false
|
poetry config virtualenvs.create false
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
# Allow installing dev dependencies to run tests
|
# Allow installing dev dependencies to run tests
|
||||||
ARG INSTALL_DEV=false
|
ARG INSTALL_DEV=false
|
||||||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
|
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
|
||||||
|
|
||||||
|
COPY --from=builder /app/barker /app
|
||||||
|
COPY --from=builder /app/frontend /app/frontend
|
||||||
|
|
||||||
ENV PYTHONPATH=/app
|
ENV PYTHONPATH=/app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
VOLUME /frontend
|
VOLUME /frontend
|
||||||
|
|
Loading…
Reference in New Issue