Updated structure.sql

This commit is contained in:
Sergei Tsõganov 2022-03-21 10:03:21 +02:00 committed by Sergei Tsõganov
parent dadcc9580b
commit f59c6ee5c3
9 changed files with 96 additions and 6 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
app/.DS_Store vendored Normal file

Binary file not shown.

BIN
app/controllers/.DS_Store vendored Normal file

Binary file not shown.

BIN
app/controllers/repp/.DS_Store vendored Normal file

Binary file not shown.

BIN
app/controllers/repp/v1/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,26 @@
module Repp
module V1
module Registrar
class AuthController < BaseController
api :GET, 'repp/v1/registrar/auth'
desc 'check user auth info, track user last login datetime and return data'
def index
registrar = current_user.registrar
data = set_values_to_data(registrar: registrar)
render_success(data: data)
end
private
def set_values_to_data(registrar:)
data = current_user.as_json(only: %i[id username roles])
data[:registrar_name] = registrar.name
data
end
end
end
end
end

View file

@ -0,0 +1,44 @@
module Repp
module V1
module Registrar
class SummaryController < BaseController
api :GET, 'repp/v1/registrar/summary'
desc 'check user summary info and return data'
def index
registrar = current_user.registrar
data = evaluate_data(registrar: registrar)
render_success(data: data)
end
private
def evaluate_data(registrar:)
data = current_user.as_json(only: %i[id username])
data[:registrar_name] = registrar.name
data[:last_login_date] = last_login_date
data[:balance] = { amount: registrar.cash_account&.balance,
currency: registrar.cash_account&.currency }
data[:domains] = registrar.domains.count
data[:contacts] = registrar.contacts.count
data[:phone] = registrar.phone
data[:email] = registrar.email
data[:billing_email] = registrar.billing_email
data[:billing_address] = registrar.address
data
end
def last_login_date
q = ApiLog::ReppLog.ransack({ request_path_eq: '/repp/v1/registrar/auth',
response_code_eq: '200',
api_user_name_cont: current_user.username,
request_method_eq: 'GET' })
q.sorts = 'id desc'
q.result.offset(1).first&.created_at
end
end
end
end
end

View file

@ -827,8 +827,7 @@ CREATE TABLE public.dnskeys (
updator_str character varying, updator_str character varying,
legacy_domain_id integer, legacy_domain_id integer,
updated_at timestamp without time zone, updated_at timestamp without time zone,
validation_datetime timestamp without time zone, validation_datetime timestamp without time zone
failed_validation_reason character varying
); );
@ -1196,7 +1195,6 @@ CREATE TABLE public.invoices (
buyer_vat_no character varying, buyer_vat_no character varying,
issue_date date NOT NULL, issue_date date NOT NULL,
e_invoice_sent_at timestamp without time zone, e_invoice_sent_at timestamp without time zone,
payment_link character varying,
CONSTRAINT invoices_due_date_is_not_before_issue_date CHECK ((due_date >= issue_date)) CONSTRAINT invoices_due_date_is_not_before_issue_date CHECK ((due_date >= issue_date))
); );
@ -5403,9 +5401,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220106123143'), ('20220106123143'),
('20220113201642'), ('20220113201642'),
('20220113220809'), ('20220113220809'),
('20220124105717'),
('20220216113112'),
('20220228093211');
('20220316140727'); ('20220316140727');

25
üpõ.preinstalled_gems Normal file
View file

@ -0,0 +1,25 @@
FROM ghcr.io/internetee/registry:gems-latest
LABEL org.opencontainers.image.source=https://github.com/internetee/registry
ARG YARN_VER='1.22.10'
ARG RAILS_ENV
ARG SECRET_KEY_BASE
ENV RAILS_ENV "$RAILS_ENV"
ENV SECRET_KEY_BASE "$SECRET_KEY_BASE"
RUN npm install -g yarn@"$YARN_VER"
RUN bash -c 'mkdir -pv -m776 {/opt/webapps/app/tmp/pids,/opt/ca,/opt/ca/newcerts}'
RUN echo -n 12 > /opt/ca/serial
RUN chmod 776 /opt/ca/serial
RUN echo '3A0e' > /opt/ca/crlnumber
RUN chmod 776 /opt/ca/crlnumber
RUN touch /opt/ca/index.txt
RUN chmod 776 /opt/ca/index.txt
WORKDIR /opt/webapps/app
COPY . .
RUN bundle exec rails assets:precompile
EXPOSE 3000