-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add people registration resource - User entity and your context to handle people business rules. - Context for new user registration. - Bcrypt to handle password issues. - Phonelib to handle phone issues. - Add unique indexes for email and phone for users database table - Logger provider with level configuration. - Configure i18n. - pt-BR translation. - en-US translation. - Add pub/sub pattern and API with dry-events. - Add ActiveSupport to the main application to facilitate general development. - Configure database cleaner for suite of tests.
- Loading branch information
1 parent
a628133
commit bb8adfe
Showing
38 changed files
with
996 additions
and
55 deletions.
There are no files selected for viewing
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,5 +1,30 @@ | ||
## [Unreleased] | ||
|
||
## [0.2.0] - 2024-02-27 | ||
|
||
### Added | ||
|
||
- User entity and your context to handle people business rules. | ||
- Context for new user registration. | ||
- Bcrypt to handle password issues. | ||
- Phonelib to handle phone issues. | ||
- Logger provider with level configuration. | ||
- Configure i18n. | ||
- `pt-BR` translation. | ||
- `en-US` translation. | ||
- Add `pub/sub` pattern and API with dry-events. | ||
- Add `ActiveSupport` to the main application to facilitate general development. | ||
- Configure database cleaner for suite of tests. | ||
|
||
### Fixed | ||
|
||
- Adjusting lint with standardrb throughout the code. | ||
- Lifecyle for core provider. | ||
|
||
### Changed | ||
|
||
- Adjusting directory patterns for test coverage. | ||
|
||
## [0.1.0] - 2024-02-06 | ||
|
||
- Initial release |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'application' | ||
require_relative "application" | ||
|
||
AuctionFunCore::Application.finalize! |
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,12 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
ENV['APP_ENV'] ||= 'development' | ||
ENV["APP_ENV"] ||= "development" | ||
|
||
require 'bundler' | ||
Bundler.setup(:default, ENV.fetch('APP_ENV', nil)) | ||
require "bundler" | ||
Bundler.setup(:default, ENV.fetch("APP_ENV", nil)) | ||
|
||
unless defined?(Dotenv) | ||
require 'dotenv' | ||
require "dotenv" | ||
Dotenv.load(".env.#{ENV.fetch("APP_ENV", nil)}") | ||
Dotenv.require_keys('DATABASE_URL') | ||
Dotenv.require_keys("DATABASE_URL") | ||
end |
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,66 @@ | ||
en-US: | ||
contracts: | ||
errors: | ||
or: "or" | ||
array?: "must be an array" | ||
empty?: "must be empty" | ||
excludes?: "must not include %{value}" | ||
excluded_from?: | ||
arg: | ||
default: "must not be one of: %{list}" | ||
range: "must not be one of: %{list_left} - %{list_right}" | ||
exclusion?: "must not be one of: %{list}" | ||
eql?: "must be equal to %{left}" | ||
not_eql?: "must not be equal to %{left}" | ||
filled?: "must be filled" | ||
format?: "is in invalid format" | ||
number?: "must be a number" | ||
odd?: "must be odd" | ||
even?: "must be even" | ||
gt?: "must be greater than %{num}" | ||
gteq?: "must be greater than or equal to %{num}" | ||
hash?: "must be a hash" | ||
included_in?: | ||
arg: | ||
default: "must be one of: %{list}" | ||
range: "must be one of: %{list_left} - %{list_right}" | ||
inclusion?: "must be one of: %{list}" | ||
includes?: "must include %{value}" | ||
bool?: "must be boolean" | ||
true?: "must be true" | ||
false?: "must be false" | ||
int?: "must be an integer" | ||
float?: "must be a float" | ||
decimal?: "must be a decimal" | ||
date?: "must be a date" | ||
date_time?: "must be a date time" | ||
time?: "must be a time" | ||
key?: "is required" | ||
attr?: "is required" | ||
lt?: "must be less than %{num}" | ||
lteq?: "must be less than or equal to %{num}" | ||
max_size?: "size cannot be greater than %{num}" | ||
min_size?: "size cannot be less than %{num}" | ||
none?: "cannot be defined" | ||
str?: "must be a string" | ||
type?: "must be %{type}" | ||
size?: | ||
arg: | ||
default: "size must be %{size}" | ||
range: "size must be within %{size_left} - %{size_right}" | ||
value: | ||
string: | ||
arg: | ||
default: "length must be %{size}" | ||
range: "length must be within %{size_left} - %{size_right}" | ||
custom: | ||
errors: | ||
default: | ||
taken: "has already been taken" | ||
not_found: "not found" | ||
password_confirmation: "doesn't match password" | ||
macro: | ||
email_format: "need to be a valid email" | ||
name_format: "must be between %{min} and %{max} characters" | ||
password_format: "must be between %{min} and %{max} characters" | ||
phone_format: "need to be a valid mobile number" |
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,65 @@ | ||
pt-BR: | ||
contracts: | ||
errors: | ||
or: "ou" | ||
array?: "deve ser um array" | ||
empty?: "deve ficar vazio" | ||
excludes?: "não deve incluir %{value}" | ||
excluded_from?: | ||
arg: | ||
default: "não deve ser um de: %{list}" | ||
range: "não deve ser um de: %{list_left} - %{list_right}" | ||
exclusion?: "não deve ser um de: %{list}" | ||
eql?: "deve ser igual a %{left}" | ||
not_eql?: "não deve ser igual a %{left}" | ||
filled?: "deve ser preenchido" | ||
format?: "está em formato inválido" | ||
number?: "deve ser um número" | ||
odd?: "deve ser ímpar" | ||
even?: "deve ser par" | ||
gt?: "deve ser maior que %{num}" | ||
gteq?: "deve ser maior ou igual a %{num}" | ||
hash?: "deve ser do tipo hash" | ||
included_in?: | ||
arg: | ||
default: "deve ser um de: %{list}" | ||
range: "deve ser um de: %{list_left} - %{list_right}" | ||
inclusion?: "deve ser um de: %{list}" | ||
includes?: "deve incluir %{value}" | ||
bool?: "deve ser booleano" | ||
true?: "deve ser verdadeiro" | ||
false?: "deve ser falso" | ||
int?: "deve ser um número inteiro" | ||
float?: "deve ser um número real" | ||
decimal?: "deve ser um número decimal" | ||
date?: "deve ser no formato de data" | ||
date_time?: "deve ser no formato de data e hora" | ||
time?: "deve ser no formato de tempo" | ||
key?: "é requerido" | ||
attr?: "é requerido" | ||
lt?: "deve ser menor que %{num}" | ||
lteq?: "deve ser menor ou igual a %{num}" | ||
max_size?: "tamanho não pode ser maior que %{num}" | ||
min_size?: "tamanho não pode ser menor que %{num}" | ||
none?: "não pode ser definido" | ||
str?: "deve ser do tipo texto" | ||
type?: "deve ser do tipo %{type}" | ||
size?: | ||
arg: | ||
default: "tamanho deve ser %{size}" | ||
range: "tamanho deve ser entre %{size_left} e %{size_right}" | ||
value: | ||
string: | ||
arg: | ||
default: "deve ser %{size} caracteres" | ||
range: "deve ser entre %{size_left} e %{size_right} caracteres" | ||
custom: | ||
default: | ||
taken: "não está disponível" | ||
not_found: "não encontrado" | ||
password_confirmation: "não corresponde à senha" | ||
macro: | ||
email_format: "não é um email válido" | ||
name_format: "deve ter entre %{min} e %{max} caracteres" | ||
password_format: "deve ter entre %{min} e %{max} caracteres" | ||
phone_format: "não é um número de celular válido" |
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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
ROM::SQL.migration do | ||
change do | ||
create_table(:users) do | ||
primary_key :id | ||
column :name, String, null: false | ||
column :email, String, null: false | ||
column :phone, String, null: false | ||
column :password_digest, String, null: false | ||
column :active, TrueClass, null: false, default: true | ||
column :created_at, DateTime, null: false | ||
column :updated_at, DateTime, null: false | ||
|
||
index :email, unique: true | ||
index :phone, unique: true | ||
end | ||
end | ||
end |
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,17 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "auction_fun_core/version" | ||
require 'zeitwerk' | ||
require "zeitwerk" | ||
|
||
require_relative '../config/boot' | ||
require_relative '../config/application' | ||
require_relative "../config/boot" | ||
require_relative "../config/application" | ||
|
||
module AuctionFunCore | ||
class Error < StandardError; end | ||
|
||
def self.root | ||
File.expand_path '..', __dir__ | ||
File.expand_path "..", __dir__ | ||
end | ||
|
||
autoload :Application, Pathname.new(File.expand_path('../config/application', __dir__)) | ||
autoload :Application, Pathname.new(File.expand_path("../config/application", __dir__)) | ||
end |
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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module AuctionFunCore | ||
module Commands | ||
module UserContext | ||
## | ||
# Abstract base class for insert new tuples on users table. | ||
# @abstract | ||
class CreateUser < ROM::Commands::Create[:sql] | ||
relation :users | ||
register_as :create | ||
result :one | ||
|
||
use :timestamps | ||
timestamp :created_at, :updated_at | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.