Documentation ¶
Index ¶
- Variables
- type ApproveLoanIn
- type ApproveLoanOut
- type ApproveLoanRes
- type CreateLoanIn
- type CreateLoanOut
- type CreateLoanRes
- type DeleteLoanOut
- type DeleteLoanRes
- type File
- type FileHeader
- type FileSaveFunc
- type GetLoanDetailOut
- type GetLoanDetailRes
- type GetLoanOut
- type GetLoanRes
- type GetUserLoanDetailOut
- type GetUserLoanDetailRes
- type GetUserLoanOut
- type GetUserLoanRes
- type LoanApp
- func (a *LoanApp) ApproveLoan(ctx context.Context, loanId, userId string, in ApproveLoanIn) (out ApproveLoanOut)
- func (a *LoanApp) ApproveLoanPatch(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) CreateLoan(ctx context.Context, userId string, in CreateLoanIn) (out CreateLoanOut)
- func (a *LoanApp) CreateLoanPost(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) DeleteLoan(ctx context.Context, loanId string, userId string) (out DeleteLoanOut)
- func (a *LoanApp) GetLoanDetail(ctx context.Context, loanId string) (out GetLoanDetailOut)
- func (a *LoanApp) GetLoans(ctx context.Context) (out GetUserLoanOut)
- func (a *LoanApp) GetUserLoanDetail(ctx context.Context, loanId, userId string) (out GetUserLoanDetailOut)
- func (a *LoanApp) GetUserLoans(ctx context.Context, userId string) (out GetUserLoanOut)
- func (a *LoanApp) LoanDetailGet(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) LoansGet(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) ProceedLoan(ctx context.Context, loanId, userId string) (out ProceedLoanOut)
- func (a *LoanApp) ProceedLoanPatch(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) UpdateLoan(ctx context.Context, loanId string, userId string, in UpdateLoanIn) (out UpdateLoanOut)
- func (a *LoanApp) UpdateLoanPut(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) UserLoanDelete(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) UserLoanDetailGet(w http.ResponseWriter, r *http.Request)
- func (a *LoanApp) UserLoansGet(w http.ResponseWriter, r *http.Request)
- type ProceedLoanOut
- type ProceedLoanRes
- type Repository
- func (r *Repository) GetLoan(ctx context.Context, loanId string) (model.LoanApplication, error)
- func (r *Repository) GetLoans(ctx context.Context) ([]model.LoanApplication, error)
- func (r *Repository) GetUser(ctx context.Context, userId string) (model.User, error)
- func (r *Repository) GetUserLoan(ctx context.Context, loanId, userId string) (model.LoanApplication, error)
- func (r *Repository) GetUserLoans(ctx context.Context, userId string) ([]model.LoanApplication, error)
- func (r *Repository) InsertLoan(ctx context.Context, loan model.LoanApplication) (model.LoanApplication, error)
- func (r *Repository) RemoveLoan(ctx context.Context, loanId string) error
- func (r *Repository) UpdateLoan(ctx context.Context, loanId string, loan model.LoanApplication) error
- type Status
- type UpdateLoanIn
- type UpdateLoanOut
- type UpdateLoanRes
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Unknown = Status{""} Wait = Status{"wait"} Process = Status{"process"} Reject = Status{"reject"} Approve = Status{"approve"} )
View Source
var ( ErrUserNotFound = errors.New("user not found") ErrUserLoanNotFound = errors.New("user loan not found") )
View Source
var ( ErrProcessLoanExist = errors.New("already have processed loan") ErrModifyProcessLoan = errors.New("cannot modify processed loan") ErrUserForbidden = errors.New("officer only") )
View Source
var ( ErrFullNameRequired = errors.New("full name required") ErrBirthDateRequired = errors.New("birth date required") ErrBirthDateNotValidDate = errors.New("birth date not valid date") ErrFullAddressRequired = errors.New("full address required") ErrPhoneRequired = errors.New("phone required") ErrPhoneMin10 = errors.New("phone min 10 characters") ErrPhoneMax15 = errors.New("phone max 15 characters") ErrPhoneNotNumbers = errors.New("phone should only contain numbers") ErrIdCardRequired = errors.New("id card image required") ErrExpInYearRequired = errors.New("experieance year required") ErrExpInYearLtZero = errors.New("experieance should greater than zero") ErrActiveFieldRequired = errors.New("active fields required") ErrActiveFieldLtZero = errors.New("active should greater than zero") ErrSowSeedsPerCycleRequired = errors.New("sow seends per cycle required") ErrSowSeedsPerCycleLtZero = errors.New("sow seends per cycle should greater than zero") ErrNeededFertilizerRequired = errors.New("needed fertilizer per cycle in kg required") ErrNeededFertilizerLtZero = errors.New("needed fertilizer per cycle in kg shoud greater than zero") ErrEstimatedYieldRequired = errors.New("estimated yield in kg required") ErrEstimatedYieldLtZero = errors.New("estimated yield in kg should greater than zero") ErrEstimatedPriceRequired = errors.New("estimated price of harvest per kg required") ErrEstimatedPriceLtZero = errors.New("estimated price of harvest per kg should greater than zero") ErrHarvestCycleRequired = errors.New("harvest cycle in monts required") ErrHarvestCycleLtZero = errors.New("harvest cycle in monts should greater than zero") ErrLoanIdrRequired = errors.New("loan application in idr required") ErrLoanIdrLtZero = errors.New("loan application in idr should greater than zero") ErrIncomePerMonthRequired = errors.New("business income per month required") ErrIncomePerMonthLtZero = errors.New("business income per month should greater than zero") ErrOutcomePerMonthRequired = errors.New("business outcome per month required") ErrOutcomePerMonthLtZero = errors.New("business outcome per month should greater than zero") )
Functions ¶
This section is empty.
Types ¶
type ApproveLoanIn ¶
type ApproveLoanIn struct {
IsApprove bool `json:"is_approve"`
}
type ApproveLoanOut ¶
type ApproveLoanOut struct { resp.Response Res ApproveLoanRes }
type ApproveLoanRes ¶
type ApproveLoanRes struct {
Id string `json:"id"`
}
type CreateLoanIn ¶
type CreateLoanIn struct { IsPrivateField bool ExpInYear int64 ActiveFieldNumber int64 SowSeedsPerCycle int64 NeededFertilizerPerCycleInKg int64 EstimatedYieldInKg int64 EstimatedPriceOfHarvestPerKg int64 HarvestCycleInMonths int64 LoanApplicationInIdr int64 BusinessIncomePerMonthInIdr int64 BusinessOutcomePerMonthInIdr int64 FullName string BirthDate string FullAddress string Phone string OtherBusiness string IdCard FileHeader }
type CreateLoanOut ¶
type CreateLoanOut struct { resp.Response Res CreateLoanRes }
type CreateLoanRes ¶
type CreateLoanRes struct {
Id string `json:"id"`
}
type DeleteLoanOut ¶
type DeleteLoanOut struct { resp.Response Res DeleteLoanRes }
type DeleteLoanRes ¶
type DeleteLoanRes struct {
Id string `json:"id"`
}
type FileHeader ¶
type GetLoanDetailOut ¶
type GetLoanDetailOut struct { resp.Response Res GetLoanDetailRes }
type GetLoanDetailRes ¶
type GetLoanDetailRes struct { IsPrivateField bool `json:"is_private_field"` ExpInYear int64 `json:"exp_in_year"` ActiveFieldNumber int64 `json:"active_field_number"` SowSeedsPerCycle int64 `json:"sow_seeds_per_cycle"` NeededFertilizerPerCycleInKg int64 `json:"needed_fertilizer_per_cycle_in_kg"` EstimatedYieldInKg int64 `json:"estimated_yield_in_kg"` EstimatedPriceOfHarvestPerKg int64 `json:"estimated_price_of_harvest_per_kg"` HarvestCycleInMonths int64 `json:"harvest_cycle_in_months"` LoanApplicationInIdr int64 `json:"loan_application_in_idr"` BusinessIncomePerMonthInIdr int64 `json:"business_income_per_month_in_idr"` BusinessOutcomePerMonthInIdr int64 `json:"business_outcome_per_month_in_idr"` LoanId string `json:"loan_id"` UserId string `json:"user_id"` FullName string `json:"full_name"` BirthDate string `json:"birth_date"` FullAddress string `json:"full_address"` Phone string `json:"phone"` OtherBusiness string `json:"other_business"` IdCardUrl string `json:"id_card_url"` Status string `json:"status"` }
type GetLoanOut ¶
type GetLoanOut struct { resp.Response Res []GetUserLoanRes }
type GetLoanRes ¶
type GetUserLoanDetailOut ¶
type GetUserLoanDetailOut struct { resp.Response Res GetUserLoanDetailRes }
type GetUserLoanDetailRes ¶
type GetUserLoanDetailRes struct { IsPrivateField bool `json:"is_private_field"` ExpInYear int64 `json:"exp_in_year"` ActiveFieldNumber int64 `json:"active_field_number"` SowSeedsPerCycle int64 `json:"sow_seeds_per_cycle"` NeededFertilizerPerCycleInKg int64 `json:"needed_fertilizer_per_cycle_in_kg"` EstimatedYieldInKg int64 `json:"estimated_yield_in_kg"` EstimatedPriceOfHarvestPerKg int64 `json:"estimated_price_of_harvest_per_kg"` HarvestCycleInMonths int64 `json:"harvest_cycle_in_months"` LoanApplicationInIdr int64 `json:"loan_application_in_idr"` BusinessIncomePerMonthInIdr int64 `json:"business_income_per_month_in_idr"` BusinessOutcomePerMonthInIdr int64 `json:"business_outcome_per_month_in_idr"` LoanId string `json:"loan_id"` UserId string `json:"user_id"` FullName string `json:"full_name"` BirthDate string `json:"birth_date"` FullAddress string `json:"full_address"` Phone string `json:"phone"` OtherBusiness string `json:"other_business"` IdCardUrl string `json:"id_card_url"` Status string `json:"status"` }
type GetUserLoanOut ¶
type GetUserLoanOut struct { resp.Response Res []GetUserLoanRes }
type GetUserLoanRes ¶
type LoanApp ¶
type LoanApp struct {
// contains filtered or unexported fields
}
func NewApp ¶
func NewApp(fileSaveFunc FileSaveFunc, repository *Repository) *LoanApp
func (*LoanApp) ApproveLoan ¶
func (a *LoanApp) ApproveLoan(ctx context.Context, loanId, userId string, in ApproveLoanIn) (out ApproveLoanOut)
func (*LoanApp) ApproveLoanPatch ¶
func (a *LoanApp) ApproveLoanPatch(w http.ResponseWriter, r *http.Request)
func (*LoanApp) CreateLoan ¶
func (a *LoanApp) CreateLoan(ctx context.Context, userId string, in CreateLoanIn) (out CreateLoanOut)
func (*LoanApp) CreateLoanPost ¶
func (a *LoanApp) CreateLoanPost(w http.ResponseWriter, r *http.Request)
func (*LoanApp) DeleteLoan ¶
func (*LoanApp) GetLoanDetail ¶
func (a *LoanApp) GetLoanDetail(ctx context.Context, loanId string) (out GetLoanDetailOut)
func (*LoanApp) GetUserLoanDetail ¶
func (a *LoanApp) GetUserLoanDetail(ctx context.Context, loanId, userId string) (out GetUserLoanDetailOut)
func (*LoanApp) GetUserLoans ¶
func (a *LoanApp) GetUserLoans(ctx context.Context, userId string) (out GetUserLoanOut)
func (*LoanApp) LoanDetailGet ¶
func (a *LoanApp) LoanDetailGet(w http.ResponseWriter, r *http.Request)
func (*LoanApp) ProceedLoan ¶
func (a *LoanApp) ProceedLoan(ctx context.Context, loanId, userId string) (out ProceedLoanOut)
func (*LoanApp) ProceedLoanPatch ¶
func (a *LoanApp) ProceedLoanPatch(w http.ResponseWriter, r *http.Request)
func (*LoanApp) UpdateLoan ¶
func (a *LoanApp) UpdateLoan(ctx context.Context, loanId string, userId string, in UpdateLoanIn) (out UpdateLoanOut)
func (*LoanApp) UpdateLoanPut ¶
func (a *LoanApp) UpdateLoanPut(w http.ResponseWriter, r *http.Request)
func (*LoanApp) UserLoanDelete ¶
func (a *LoanApp) UserLoanDelete(w http.ResponseWriter, r *http.Request)
func (*LoanApp) UserLoanDetailGet ¶
func (a *LoanApp) UserLoanDetailGet(w http.ResponseWriter, r *http.Request)
func (*LoanApp) UserLoansGet ¶
func (a *LoanApp) UserLoansGet(w http.ResponseWriter, r *http.Request)
type ProceedLoanOut ¶
type ProceedLoanOut struct { resp.Response Res ProceedLoanRes }
type ProceedLoanRes ¶
type ProceedLoanRes struct {
Id string `json:"id"`
}
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *pgx.Conn) *Repository
func (*Repository) GetLoan ¶
func (r *Repository) GetLoan(ctx context.Context, loanId string) (model.LoanApplication, error)
func (*Repository) GetLoans ¶
func (r *Repository) GetLoans(ctx context.Context) ([]model.LoanApplication, error)
func (*Repository) GetUserLoan ¶
func (r *Repository) GetUserLoan(ctx context.Context, loanId, userId string) (model.LoanApplication, error)
func (*Repository) GetUserLoans ¶
func (r *Repository) GetUserLoans(ctx context.Context, userId string) ([]model.LoanApplication, error)
func (*Repository) InsertLoan ¶
func (r *Repository) InsertLoan(ctx context.Context, loan model.LoanApplication) (model.LoanApplication, error)
func (*Repository) RemoveLoan ¶
func (r *Repository) RemoveLoan(ctx context.Context, loanId string) error
func (*Repository) UpdateLoan ¶
func (r *Repository) UpdateLoan(ctx context.Context, loanId string, loan model.LoanApplication) error
type UpdateLoanIn ¶
type UpdateLoanIn struct { IsPrivateField bool ExpInYear int64 ActiveFieldNumber int64 SowSeedsPerCycle int64 NeededFertilizerPerCycleInKg int64 EstimatedYieldInKg int64 EstimatedPriceOfHarvestPerKg int64 HarvestCycleInMonths int64 LoanApplicationInIdr int64 BusinessIncomePerMonthInIdr int64 BusinessOutcomePerMonthInIdr int64 FullName string BirthDate string FullAddress string Phone string OtherBusiness string IdCard FileHeader }
type UpdateLoanOut ¶
type UpdateLoanOut struct { resp.Response Res UpdateLoanRes }
type UpdateLoanRes ¶
type UpdateLoanRes struct {
Id string `json:"id"`
}
Click to show internal directories.
Click to hide internal directories.