Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2b433aa
auction api for mobile app
OlegPhenomenon Oct 13, 2023
419956e
fixed websocket issue
OlegPhenomenon Nov 27, 2023
7b286c9
updated broadcast
OlegPhenomenon Dec 4, 2023
33f2e42
updated
OlegPhenomenon Dec 11, 2023
dabceca
updated websocket
Dec 29, 2023
f6a5a8b
changes route paths
Jan 2, 2024
c526b73
updated response
Jan 15, 2024
53fa8f9
added new path
Jan 22, 2024
c9baea1
updated logs
Jan 25, 2024
30efb81
added profile controller
Jan 31, 2024
c6c5c97
added billing profile controller for api
Feb 8, 2024
e548e09
added endpoints for create user and billing profile
Feb 16, 2024
d2d5ec4
added tara auth
OlegPhenomenon Mar 13, 2024
d79c7d4
added callbakc for payment by mobile
OlegPhenomenon Mar 25, 2024
2d3be3d
added hmac validation in tara controller
OlegPhenomenon Mar 27, 2024
92b2a86
fixed customization ident
OlegPhenomenon Mar 27, 2024
7e9b5f0
added offers endpoint
OlegPhenomenon Apr 12, 2024
fbeaf95
remove uneccesary comments, updated json response for offers
OlegPhenomenon May 3, 2024
2fcb410
remove log
OlegPhenomenon Dec 27, 2024
3367680
Changes:
OlegPhenomenon Mar 7, 2025
9faa9a7
added email and password authetication
OlegPhenomenon Mar 21, 2025
94e48f9
refactor invoice controller
OlegPhenomenon Mar 25, 2025
857a216
handle deposit
OlegPhenomenon Mar 26, 2025
7b54040
updated invoices api
OlegPhenomenon Apr 7, 2025
953f8c5
updated websocket data for mobile api
OlegPhenomenon Apr 11, 2025
ec71893
fixed invoices
OlegPhenomenon Apr 21, 2025
1eaac0b
added skip auth checker to profile in create action
OlegPhenomenon May 29, 2025
145a272
added api healthcare
OlegPhenomenon Jun 13, 2025
ea788ba
added api healthcheck
OlegPhenomenon Jun 20, 2025
ef0dd22
fixes
OlegPhenomenon Jul 21, 2025
b73362a
fixed profile controller
OlegPhenomenon Jul 22, 2025
9949777
added tests for autobider and auction
OlegPhenomenon Jul 23, 2025
3c79b92
cover api by tests
OlegPhenomenon Jul 28, 2025
07c06f2
xied invoices test
OlegPhenomenon Jul 28, 2025
b76c6e7
updated tests and refactored api
OlegPhenomenon Jul 29, 2025
586bdec
updated sign up issues
OlegPhenomenon Jul 30, 2025
b1003cf
normalize platforms
OlegPhenomenon Nov 19, 2025
71df9c2
move bindex to the development-test env in gemfile
OlegPhenomenon Nov 19, 2025
7337647
remove dublicate
OlegPhenomenon Nov 19, 2025
d4ab9b9
create billing profile if it not exists when bid
OlegPhenomenon Nov 25, 2025
4a70438
added deposit value for auction response
OlegPhenomenon Nov 27, 2025
48f8c35
added delete action to billing profiles controller
OlegPhenomenon Nov 28, 2025
9cd831d
updated mobile payment page
OlegPhenomenon Dec 2, 2025
f28ce84
added domain name in json response of invoice endpoint
OlegPhenomenon Dec 2, 2025
2a79e84
updated gemfile.lock
OlegPhenomenon Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ CLAUDE.md
/app/assets/builds/*
!/app/assets/builds/.keep
.cursorindexingignore
.specstory
.specstory
130 changes: 130 additions & 0 deletions Dockerfile.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.4.1
FROM registry.docker.com/library/ruby:$RUBY_VERSION-bullseye AS base

# Rails app lives here
WORKDIR /opt/webapps/app

# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development" \
LANG=et_EE.UTF-8 \
RAILS_SERVE_STATIC_FILES="true" \
RAILS_LOG_TO_STDOUT="true"

# Throw-away build stage to reduce size of final image
FROM base AS build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install packages needed to build gems and node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
imagemagick \
curl \
wget \
gnupg2 \
git \
apt-utils \
libpq-dev \
libvips \
node-gyp \
pkg-config \
python-is-python3 \
libxslt1-dev \
libxml2-dev \
wkhtmltopdf \
locales \
postgresql-client

# Configure locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# et_EE.UTF-8 UTF-8/et_EE.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=et_EE.UTF-8

# Install JavaScript dependencies
ARG NODE_VERSION=18.16.0
ARG YARN_VERSION=1.22.19
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
npm install -g yarn@$YARN_VERSION && \
npm install -g n && \
n stable && \
rm -rf /tmp/node-build-master

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

# Install node modules
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --check-files

# Copy application code
COPY . .

# Create necessary directories for K8s
RUN mkdir -p /opt/webapps/app/tmp/pids /opt/webapps/app/tmp/k8s /opt/webapps/app/log

# Make entrypoint script executable
RUN chmod +x /opt/webapps/app/bin/docker-entrypoint

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

# Precompile assets with a real random secret key
RUN SECRET_KEY_BASE=$(openssl rand -hex 64) bundle exec rails assets:precompile

# Final stage for app image
FROM base

# Install packages needed for deployment (minimal set for production)
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
curl \
libvips \
postgresql-client \
wkhtmltopdf \
imagemagick \
locales \
libxslt1-dev \
libxml2-dev && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# et_EE.UTF-8 UTF-8/et_EE.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=et_EE.UTF-8 && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /opt/webapps/app /opt/webapps/app

# K8s specific configurations
RUN mkdir -p /opt/webapps/app/tmp/pids /opt/webapps/app/tmp/k8s /opt/webapps/app/storage

# Ensure entrypoint script is executable in final image
RUN chmod +x /opt/webapps/app/bin/docker-entrypoint

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails /opt/webapps/app/log /opt/webapps/app/tmp /opt/webapps/app/storage
USER rails:rails

# Create a health check endpoint file for Kubernetes probes
RUN touch /opt/webapps/app/tmp/k8s/ready

# Entrypoint prepares the database.
ENTRYPOINT ["/opt/webapps/app/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ group :development, :test do
gem 'bundler-audit'
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'pry'
gem 'bindex'
end

group :development do
Expand Down Expand Up @@ -95,3 +96,6 @@ group :test do
gem 'spy'
gem 'webmock'
end

gem 'devise-jwt'
gem 'jsonapi-serializer'
71 changes: 64 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ GEM
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
addressable (2.8.8)
public_suffix (>= 2.0.2, < 8.0)
aes_key_wrap (1.1.0)
airbrake (13.0.5)
airbrake-ruby (~> 6.0)
Expand All @@ -101,7 +101,7 @@ GEM
attr_required (1.0.2)
base64 (0.3.0)
bcrypt (3.1.20)
benchmark (0.4.1)
benchmark (0.5.0)
bigdecimal (3.3.1)
bindata (2.5.1)
bindex (0.8.1)
Expand Down Expand Up @@ -129,7 +129,7 @@ GEM
logger (~> 1.5)
coderay (1.1.3)
concurrent-ruby (1.3.5)
connection_pool (2.5.4)
connection_pool (2.5.5)
crack (1.0.0)
bigdecimal
rexml
Expand All @@ -155,9 +155,21 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-jwt (0.11.0)
devise (~> 4.0)
warden-jwt_auth (~> 0.8)
docile (1.4.1)
domain_name (0.6.20240107)
drb (2.2.3)
dry-auto_inject (1.0.1)
dry-core (~> 1.0)
zeitwerk (~> 2.6)
dry-configurable (1.1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
email_validator (2.2.4)
activemodel
erb (5.0.2)
Expand All @@ -181,6 +193,8 @@ GEM
ffi (1.17.2-arm-linux-gnu)
ffi (1.17.2-arm-linux-musl)
ffi (1.17.2-arm64-darwin)
ffi (1.17.2-x86-linux-gnu)
ffi (1.17.2-x86-linux-musl)
ffi (1.17.2-x86_64-darwin)
ffi (1.17.2-x86_64-linux-gnu)
ffi (1.17.2-x86_64-linux-musl)
Expand All @@ -205,6 +219,12 @@ GEM
google-protobuf (4.33.0-arm64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.33.0-x86-linux-gnu)
bigdecimal
rake (>= 13)
google-protobuf (4.33.0-x86-linux-musl)
bigdecimal
rake (>= 13)
google-protobuf (4.33.0-x86_64-darwin)
bigdecimal
rake (>= 13)
Expand Down Expand Up @@ -256,6 +276,8 @@ GEM
bindata
faraday (~> 2.0)
faraday-follow_redirects
jsonapi-serializer (2.2.0)
activesupport (>= 4.2)
jwt (2.10.2)
base64
language_server-protocol (3.17.0.5)
Expand Down Expand Up @@ -299,7 +321,7 @@ GEM
rake
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (5.26.0)
minitest (5.26.2)
money (6.19.0)
i18n (>= 0.6.4, <= 2)
msgpack (1.8.0)
Expand Down Expand Up @@ -371,6 +393,7 @@ GEM
pg (1.6.2)
pg (1.6.2-aarch64-linux)
pg (1.6.2-aarch64-linux-musl)
pg (1.6.2-aarch64-mingw-ucrt)
pg (1.6.2-arm64-darwin)
pg (1.6.2-x86_64-darwin)
pg (1.6.2-x86_64-linux)
Expand All @@ -392,7 +415,7 @@ GEM
psych (5.2.6)
date
stringio
public_suffix (6.0.2)
public_suffix (7.0.0)
puma (7.1.0)
nio4r (~> 2.0)
racc (1.8.1)
Expand Down Expand Up @@ -515,18 +538,32 @@ GEM
sass-embedded (1.93.2)
google-protobuf (~> 4.31)
rake (>= 13)
sass-embedded (1.93.2-aarch64-linux-android)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-aarch64-linux-gnu)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-aarch64-linux-musl)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-aarch64-mingw-ucrt)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-arm-linux-androideabi)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-arm-linux-gnueabihf)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-arm-linux-musleabihf)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-arm64-darwin)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-riscv64-linux-android)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-riscv64-linux-gnu)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-riscv64-linux-musl)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-x86_64-darwin)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-x86_64-linux-android)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-x86_64-linux-gnu)
google-protobuf (~> 4.31)
sass-embedded (1.93.2-x86_64-linux-musl)
Expand Down Expand Up @@ -571,7 +608,7 @@ GEM
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.0.4)
uri (1.1.1)
useragent (0.16.11)
validate_url (1.0.15)
activemodel (>= 3.0.0)
Expand All @@ -583,6 +620,11 @@ GEM
concurrent-ruby (~> 1)
warden (1.2.9)
rack (>= 2.0.9)
warden-jwt_auth (0.8.0)
dry-auto_inject (>= 0.8, < 2)
dry-configurable (>= 0.13, < 2)
jwt (~> 2.1)
warden (~> 1.2)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand Down Expand Up @@ -610,19 +652,32 @@ GEM

PLATFORMS
aarch64-linux
aarch64-linux-android
aarch64-linux-gnu
aarch64-linux-musl
aarch64-mingw-ucrt
arm-linux-androideabi
arm-linux-gnu
arm-linux-gnueabihf
arm-linux-musl
arm-linux-musleabihf
arm64-darwin
riscv64-linux-android
riscv64-linux-gnu
riscv64-linux-musl
ruby
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux
x86_64-linux-android
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
airbrake
amazing_print
bindex
bootsnap (>= 1.1.0)
brakeman
bundler-audit
Expand All @@ -637,6 +692,7 @@ DEPENDENCIES
delayed_job (~> 4.1.0)
delayed_job_active_record
devise (~> 4.9.3)
devise-jwt
directo!
faker
faraday (>= 2.14.0)
Expand All @@ -648,6 +704,7 @@ DEPENDENCIES
i18n-debug
jbuilder (~> 2.11)
jsbundling-rails
jsonapi-serializer
jwt
letter_opener (~> 1.8)
letter_opener_web (~> 3.0)
Expand Down
18 changes: 18 additions & 0 deletions app/broadcasts/auctions/update_list_broadcast_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def call

private

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def post_call
participants = auction.offers.map(&:user)

Expand All @@ -25,6 +27,22 @@ def post_call
locals: { auction:, user:, updated: participants.include?(user) }
end

auction_json = {
domain_name: auction.domain_name,
starts_at: auction.starts_at,
ends_at: auction.ends_at,
id: auction.uuid,
highest_bid: auction.currently_winning_offer&.price.to_f,
highest_bidder: auction.currently_winning_offer&.username,
highest_bidder_uuid: auction.currently_winning_offer&.user&.uuid,
min_bids_step: auction.min_bids_step,
auction_type: auction&.platform,
enable_deposit: auction.enable_deposit,
requirement_deposit_in_cents: auction.requirement_deposit_in_cents
}

ActionCable.server.broadcast('auctions_api', { auction: auction_json })

broadcast_later 'auctions',
'auctions/streams/updated_list',
locals: { auction:, user: nil, updated: false }
Expand Down
Loading
Loading