feat(invitations): add organization invitation drafts with salary range rules
This commit is contained in:
1 parent
28337d84cb
commit
bd23c839fd
36 files changed
+7018
-83
No files matched your search
@@ -102,14 +102,9 @@ func (format NeedWorkFormat) IsKnown() bool {
|
||||
}
|
||||
}
|
||||
|
||||
// NeedSalaryRange is a monthly RUB range with an explicit tax basis.
|
||||
type NeedSalaryRange struct {
|
||||
SalaryFrom int64 `json:"salary_from"`
|
||||
SalaryTo int64 `json:"salary_to"`
|
||||
Currency string `json:"currency"`
|
||||
Period string `json:"period"`
|
||||
TaxBasis string `json:"tax_basis"`
|
||||
}
|
||||
// NeedSalaryRange is a monthly RUB range with an explicit tax basis. A need
|
||||
// and an invitation share the money rules of SalaryRange.
|
||||
type NeedSalaryRange = SalaryRange
|
||||
|
||||
// NeedSkill is one ordered required or desired skill. TaxonomyCode is nil
|
||||
// when the platform has no reviewed mapping for the supplied name.
|
||||
@@ -749,15 +744,7 @@ func validNeedWorkFormats(formats []NeedWorkFormat) bool {
|
||||
}
|
||||
|
||||
func validNeedSalaryRange(value NeedSalaryRange) bool {
|
||||
if value.SalaryFrom < 1000 || value.SalaryFrom > 100000000 || value.SalaryFrom%1000 != 0 ||
|
||||
value.SalaryTo < 1000 || value.SalaryTo > 100000000 || value.SalaryTo%1000 != 0 ||
|
||||
value.Currency != "RUB" || value.Period != "month" || (value.TaxBasis != "net" && value.TaxBasis != "gross") ||
|
||||
value.SalaryFrom >= value.SalaryTo {
|
||||
return false
|
||||
}
|
||||
width := value.SalaryTo - value.SalaryFrom
|
||||
sum := value.SalaryTo + value.SalaryFrom
|
||||
return 20*width >= sum && 5*width <= sum
|
||||
return value.Validate() == nil
|
||||
}
|
||||
|
||||
func validNeedTaxonomyCode(value string) bool {
|
||||
|
||||
Reference in new issue
Block a user