mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 05:56:20 +02:00
Fixed codeclimate issues and removed unnecessary files
This commit is contained in:
parent
f59c6ee5c3
commit
d50c3f0b45
12 changed files with 12 additions and 105 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
BIN
app/.DS_Store
vendored
BIN
app/.DS_Store
vendored
Binary file not shown.
BIN
app/controllers/.DS_Store
vendored
BIN
app/controllers/.DS_Store
vendored
Binary file not shown.
BIN
app/controllers/repp/.DS_Store
vendored
BIN
app/controllers/repp/.DS_Store
vendored
Binary file not shown.
BIN
app/controllers/repp/v1/.DS_Store
vendored
BIN
app/controllers/repp/v1/.DS_Store
vendored
Binary file not shown.
|
@ -1,26 +0,0 @@
|
|||
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
|
|
@ -1,44 +0,0 @@
|
|||
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
|
|
@ -3,7 +3,10 @@ class Action < ApplicationRecord
|
|||
|
||||
belongs_to :user
|
||||
belongs_to :contact, optional: true
|
||||
has_many :subactions, class_name: 'Action', foreign_key: 'bulk_action_id', dependent: :destroy
|
||||
has_many :subactions, class_name: 'Action',
|
||||
foreign_key: 'bulk_action_id',
|
||||
inverse_of: :action,
|
||||
dependent: :destroy
|
||||
belongs_to :bulk_action, class_name: 'Action', optional: true
|
||||
|
||||
validates :operation, inclusion: { in: proc { |action| action.class.valid_operations } }
|
||||
|
@ -36,3 +39,4 @@ class Action < ApplicationRecord
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
class BulkAction < Action
|
||||
end
|
||||
class BulkAction < Action; end
|
||||
|
|
|
@ -110,11 +110,12 @@ class RegistrantUser < User
|
|||
def last_name
|
||||
username.split.second
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
def update_related_contacts
|
||||
grouped_contacts = Contact.where(ident: ident, ident_country_code: country.alpha2)
|
||||
.where('UPPER(name) != UPPER(?)', username)
|
||||
.includes(:registrar).group_by { |c| c.registrar }
|
||||
.includes(:registrar)
|
||||
.group_by(&:registrar)
|
||||
grouped_contacts.each do |registrar, contacts|
|
||||
bulk_action, action = actions.create!(operation: :bulk_update) if contacts.size > 1
|
||||
contacts.each do |c|
|
||||
|
@ -125,7 +126,7 @@ class RegistrantUser < User
|
|||
registrar.notify(bulk_action || action)
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
class << self
|
||||
def find_or_create_by_api_data(user_data = {})
|
||||
return false unless user_data[:ident]
|
||||
|
|
|
@ -5,8 +5,6 @@ builder.extension do
|
|||
builder.tag!('changePoll:date', action.created_at.utc.xmlschema)
|
||||
builder.tag!('changePoll:svTRID', action.id)
|
||||
builder.tag!('changePoll:who', action.user)
|
||||
if action.bulk_action?
|
||||
builder.tag!('changePoll:reason', 'Auto-update according to official data')
|
||||
end
|
||||
builder.tag!('changePoll:reason', 'Auto-update according to official data') if action.bulk_action?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue