created loan-orders and created table
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
DROP TABLE IF EXISTS loan_orders;
|
||||||
DROP TABLE IF EXISTS branch_user;
|
DROP TABLE IF EXISTS branch_user;
|
||||||
DROP TABLE IF EXISTS roles;
|
DROP TABLE IF EXISTS roles;
|
||||||
DROP TABLE IF EXISTS loan_order_required_docs;
|
DROP TABLE IF EXISTS loan_order_required_docs;
|
||||||
|
|||||||
@@ -118,4 +118,79 @@ CREATE TABLE IF NOT EXISTS branch_user (
|
|||||||
user_id bigint REFERENCES users(id) ON DELETE CASCADE,
|
user_id bigint REFERENCES users(id) ON DELETE CASCADE,
|
||||||
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||||
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS loan_orders (
|
||||||
|
id bigserial PRIMARY KEY,
|
||||||
|
unique_id character varying(255),
|
||||||
|
source character varying(255) DEFAULT 'web'::character varying,
|
||||||
|
user_id bigint,
|
||||||
|
loan_type bigint NOT NULL,
|
||||||
|
region character varying(2) NOT NULL,
|
||||||
|
branch_id bigint NOT NULL,
|
||||||
|
customer_name character varying(255) NOT NULL,
|
||||||
|
customer_surname character varying(255) NOT NULL,
|
||||||
|
customer_patronic_name character varying(255),
|
||||||
|
passport_address character varying(255) NOT NULL,
|
||||||
|
real_address character varying(255) NOT NULL,
|
||||||
|
passport_serie character varying(255) NOT NULL,
|
||||||
|
passport_id character varying(255) NOT NULL,
|
||||||
|
passport_given_at date NOT NULL,
|
||||||
|
passport_given_by character varying(255) NOT NULL,
|
||||||
|
born_place character varying(255) NOT NULL,
|
||||||
|
born_at date NOT NULL,
|
||||||
|
email character varying(255),
|
||||||
|
phone character varying(255) NOT NULL,
|
||||||
|
phone_additional character varying(255),
|
||||||
|
phone_home character varying(255),
|
||||||
|
work_region character varying(255),
|
||||||
|
work_province_id bigint,
|
||||||
|
work_company character varying(255),
|
||||||
|
work_company_accountant_number character varying(255),
|
||||||
|
work_started_at date,
|
||||||
|
work_salary character varying(255),
|
||||||
|
work_position character varying(255),
|
||||||
|
education character varying(255) NOT NULL,
|
||||||
|
marriage_status character varying(255) NOT NULL,
|
||||||
|
passport_one text NOT NULL,
|
||||||
|
passport_two text NOT NULL,
|
||||||
|
passport_three text NOT NULL,
|
||||||
|
passport_four text NOT NULL,
|
||||||
|
loan_amount character varying(255),
|
||||||
|
card_number character varying(255),
|
||||||
|
card_name character varying(255),
|
||||||
|
card_month character varying(255),
|
||||||
|
card_year character varying(255),
|
||||||
|
guarantor_name character varying(255),
|
||||||
|
guarantor_surname character varying(255),
|
||||||
|
guarantor_patronic_name character varying(255),
|
||||||
|
guarantor_passport_serie character varying(255),
|
||||||
|
guarantor_passport_id character varying(255),
|
||||||
|
guarantor_card_number character varying(255),
|
||||||
|
guarantor_card_name character varying(255),
|
||||||
|
guarantor_card_month character varying(255),
|
||||||
|
guarantor_card_year character varying(255),
|
||||||
|
guarantor_note character varying(255),
|
||||||
|
guarantor_2_name character varying(255),
|
||||||
|
guarantor_2_surname character varying(255),
|
||||||
|
guarantor_2_patronic_name character varying(255),
|
||||||
|
guarantor_2_passport_serie character varying(255),
|
||||||
|
guarantor_2_passport_id character varying(255),
|
||||||
|
guarantor_2_card_number character varying(255),
|
||||||
|
guarantor_2_card_name character varying(255),
|
||||||
|
guarantor_2_card_month character varying(255),
|
||||||
|
guarantor_2_card_year character varying(255),
|
||||||
|
guarantor_2_note character varying(255),
|
||||||
|
loan_card_number character varying(255),
|
||||||
|
loan_card_name character varying(255),
|
||||||
|
loan_card_month character varying(255),
|
||||||
|
loan_card_year character varying(255),
|
||||||
|
loan_order_required_doc_id bigint,
|
||||||
|
status character varying(255),
|
||||||
|
satisfiable character varying(255),
|
||||||
|
notes text,
|
||||||
|
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||||
|
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|||||||
746
docs/docs.go
746
docs/docs.go
@@ -408,6 +408,296 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/loan-orders": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Returns paginated loan orders with optional filters",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "List loan orders",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Filter by status",
|
||||||
|
"name": "status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Filter by branch ID",
|
||||||
|
"name": "branch_id",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Filter by user ID",
|
||||||
|
"name": "user_id",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Filter by region",
|
||||||
|
"name": "region",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1,
|
||||||
|
"description": "Page number",
|
||||||
|
"name": "page",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"default": 10,
|
||||||
|
"description": "Items per page",
|
||||||
|
"name": "limit",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Creates a new loan order",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Create loan order",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Loan order payload",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/loanorders.CreateLoanOrderDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Created",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/loan-orders/{id}": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Returns a single loan order",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Get loan order by ID",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Loan order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not Found",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Updates an existing loan order",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Update loan order",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Loan order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Loan order payload",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/loanorders.UpdateLoanOrderDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not Found",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Deletes a loan order",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Delete loan order",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Loan order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not Found",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/loan-types": {
|
"/loan-types": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -3039,6 +3329,462 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"loanorders.CreateLoanOrderDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"bornAt",
|
||||||
|
"bornPlace",
|
||||||
|
"branchId",
|
||||||
|
"customerName",
|
||||||
|
"customerSurname",
|
||||||
|
"education",
|
||||||
|
"loanType",
|
||||||
|
"marriageStatus",
|
||||||
|
"passportAddress",
|
||||||
|
"passportFour",
|
||||||
|
"passportGivenAt",
|
||||||
|
"passportGivenBy",
|
||||||
|
"passportId",
|
||||||
|
"passportOne",
|
||||||
|
"passportSerie",
|
||||||
|
"passportThree",
|
||||||
|
"passportTwo",
|
||||||
|
"phone",
|
||||||
|
"realAddress",
|
||||||
|
"region"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"bornAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"bornPlace": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"branchId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"cardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"education": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Note": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Surname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorNote": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanAmount": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanOrderRequiredDocId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"loanType": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"marriageStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"notes": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportFour": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportOne": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportThree": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportTwo": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phone": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneAdditional": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneHome": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"realAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"satisfiable": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uniqueId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"userId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workCompany": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workCompanyAccountantNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workPosition": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workProvinceId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workRegion": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workSalary": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workStartedAt": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"loanorders.UpdateLoanOrderDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"bornAt",
|
||||||
|
"bornPlace",
|
||||||
|
"branchId",
|
||||||
|
"customerName",
|
||||||
|
"customerSurname",
|
||||||
|
"education",
|
||||||
|
"loanType",
|
||||||
|
"marriageStatus",
|
||||||
|
"passportAddress",
|
||||||
|
"passportFour",
|
||||||
|
"passportGivenAt",
|
||||||
|
"passportGivenBy",
|
||||||
|
"passportId",
|
||||||
|
"passportOne",
|
||||||
|
"passportSerie",
|
||||||
|
"passportThree",
|
||||||
|
"passportTwo",
|
||||||
|
"phone",
|
||||||
|
"realAddress",
|
||||||
|
"region"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"bornAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"bornPlace": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"branchId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"cardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"education": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Note": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Surname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorNote": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanAmount": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanOrderRequiredDocId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"loanType": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"marriageStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"notes": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportFour": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportOne": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportThree": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportTwo": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phone": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneAdditional": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneHome": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"realAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"satisfiable": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uniqueId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"userId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workCompany": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workCompanyAccountantNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workPosition": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workProvinceId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workRegion": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workSalary": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workStartedAt": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"loansdocument.CreateLoanDocumentDTO": {
|
"loansdocument.CreateLoanDocumentDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
@@ -402,6 +402,296 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/loan-orders": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Returns paginated loan orders with optional filters",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "List loan orders",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Filter by status",
|
||||||
|
"name": "status",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Filter by branch ID",
|
||||||
|
"name": "branch_id",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Filter by user ID",
|
||||||
|
"name": "user_id",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Filter by region",
|
||||||
|
"name": "region",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"default": 1,
|
||||||
|
"description": "Page number",
|
||||||
|
"name": "page",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"default": 10,
|
||||||
|
"description": "Items per page",
|
||||||
|
"name": "limit",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Creates a new loan order",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Create loan order",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Loan order payload",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/loanorders.CreateLoanOrderDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Created",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/loan-orders/{id}": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Returns a single loan order",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Get loan order by ID",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Loan order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not Found",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Updates an existing loan order",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Update loan order",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Loan order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Loan order payload",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/loanorders.UpdateLoanOrderDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not Found",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Deletes a loan order",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"loan-orders"
|
||||||
|
],
|
||||||
|
"summary": "Delete loan order",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Loan order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppSuccess"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not Found",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/appresult.AppError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/loan-types": {
|
"/loan-types": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -3033,6 +3323,462 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"loanorders.CreateLoanOrderDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"bornAt",
|
||||||
|
"bornPlace",
|
||||||
|
"branchId",
|
||||||
|
"customerName",
|
||||||
|
"customerSurname",
|
||||||
|
"education",
|
||||||
|
"loanType",
|
||||||
|
"marriageStatus",
|
||||||
|
"passportAddress",
|
||||||
|
"passportFour",
|
||||||
|
"passportGivenAt",
|
||||||
|
"passportGivenBy",
|
||||||
|
"passportId",
|
||||||
|
"passportOne",
|
||||||
|
"passportSerie",
|
||||||
|
"passportThree",
|
||||||
|
"passportTwo",
|
||||||
|
"phone",
|
||||||
|
"realAddress",
|
||||||
|
"region"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"bornAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"bornPlace": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"branchId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"cardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"education": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Note": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Surname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorNote": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanAmount": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanOrderRequiredDocId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"loanType": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"marriageStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"notes": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportFour": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportOne": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportThree": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportTwo": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phone": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneAdditional": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneHome": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"realAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"satisfiable": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uniqueId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"userId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workCompany": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workCompanyAccountantNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workPosition": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workProvinceId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workRegion": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workSalary": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workStartedAt": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"loanorders.UpdateLoanOrderDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"bornAt",
|
||||||
|
"bornPlace",
|
||||||
|
"branchId",
|
||||||
|
"customerName",
|
||||||
|
"customerSurname",
|
||||||
|
"education",
|
||||||
|
"loanType",
|
||||||
|
"marriageStatus",
|
||||||
|
"passportAddress",
|
||||||
|
"passportFour",
|
||||||
|
"passportGivenAt",
|
||||||
|
"passportGivenBy",
|
||||||
|
"passportId",
|
||||||
|
"passportOne",
|
||||||
|
"passportSerie",
|
||||||
|
"passportThree",
|
||||||
|
"passportTwo",
|
||||||
|
"phone",
|
||||||
|
"realAddress",
|
||||||
|
"region"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"bornAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"bornPlace": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"branchId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"cardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"customerSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"education": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2CardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Note": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2PatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantor2Surname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorNote": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPassportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorPatronicName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"guarantorSurname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanAmount": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardMonth": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanCardYear": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"loanOrderRequiredDocId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"loanType": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"marriageStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"notes": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportFour": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportGivenBy": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportOne": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportSerie": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportThree": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passportTwo": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phone": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneAdditional": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phoneHome": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"realAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"satisfiable": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uniqueId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"userId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workCompany": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workCompanyAccountantNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workPosition": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workProvinceId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"workRegion": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workSalary": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workStartedAt": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"loansdocument.CreateLoanDocumentDTO": {
|
"loansdocument.CreateLoanDocumentDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
@@ -133,6 +133,322 @@ definitions:
|
|||||||
- name
|
- name
|
||||||
- region
|
- region
|
||||||
type: object
|
type: object
|
||||||
|
loanorders.CreateLoanOrderDTO:
|
||||||
|
properties:
|
||||||
|
bornAt:
|
||||||
|
type: string
|
||||||
|
bornPlace:
|
||||||
|
type: string
|
||||||
|
branchId:
|
||||||
|
type: integer
|
||||||
|
cardMonth:
|
||||||
|
type: string
|
||||||
|
cardName:
|
||||||
|
type: string
|
||||||
|
cardNumber:
|
||||||
|
type: string
|
||||||
|
cardYear:
|
||||||
|
type: string
|
||||||
|
customerName:
|
||||||
|
type: string
|
||||||
|
customerPatronicName:
|
||||||
|
type: string
|
||||||
|
customerSurname:
|
||||||
|
type: string
|
||||||
|
education:
|
||||||
|
type: string
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
guarantor2CardMonth:
|
||||||
|
type: string
|
||||||
|
guarantor2CardName:
|
||||||
|
type: string
|
||||||
|
guarantor2CardNumber:
|
||||||
|
type: string
|
||||||
|
guarantor2CardYear:
|
||||||
|
type: string
|
||||||
|
guarantor2Name:
|
||||||
|
type: string
|
||||||
|
guarantor2Note:
|
||||||
|
type: string
|
||||||
|
guarantor2PassportId:
|
||||||
|
type: string
|
||||||
|
guarantor2PassportSerie:
|
||||||
|
type: string
|
||||||
|
guarantor2PatronicName:
|
||||||
|
type: string
|
||||||
|
guarantor2Surname:
|
||||||
|
type: string
|
||||||
|
guarantorCardMonth:
|
||||||
|
type: string
|
||||||
|
guarantorCardName:
|
||||||
|
type: string
|
||||||
|
guarantorCardNumber:
|
||||||
|
type: string
|
||||||
|
guarantorCardYear:
|
||||||
|
type: string
|
||||||
|
guarantorName:
|
||||||
|
type: string
|
||||||
|
guarantorNote:
|
||||||
|
type: string
|
||||||
|
guarantorPassportId:
|
||||||
|
type: string
|
||||||
|
guarantorPassportSerie:
|
||||||
|
type: string
|
||||||
|
guarantorPatronicName:
|
||||||
|
type: string
|
||||||
|
guarantorSurname:
|
||||||
|
type: string
|
||||||
|
loanAmount:
|
||||||
|
type: string
|
||||||
|
loanCardMonth:
|
||||||
|
type: string
|
||||||
|
loanCardName:
|
||||||
|
type: string
|
||||||
|
loanCardNumber:
|
||||||
|
type: string
|
||||||
|
loanCardYear:
|
||||||
|
type: string
|
||||||
|
loanOrderRequiredDocId:
|
||||||
|
type: integer
|
||||||
|
loanType:
|
||||||
|
type: integer
|
||||||
|
marriageStatus:
|
||||||
|
type: string
|
||||||
|
notes:
|
||||||
|
type: string
|
||||||
|
passportAddress:
|
||||||
|
type: string
|
||||||
|
passportFour:
|
||||||
|
type: string
|
||||||
|
passportGivenAt:
|
||||||
|
type: string
|
||||||
|
passportGivenBy:
|
||||||
|
type: string
|
||||||
|
passportId:
|
||||||
|
type: string
|
||||||
|
passportOne:
|
||||||
|
type: string
|
||||||
|
passportSerie:
|
||||||
|
type: string
|
||||||
|
passportThree:
|
||||||
|
type: string
|
||||||
|
passportTwo:
|
||||||
|
type: string
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
phoneAdditional:
|
||||||
|
type: string
|
||||||
|
phoneHome:
|
||||||
|
type: string
|
||||||
|
realAddress:
|
||||||
|
type: string
|
||||||
|
region:
|
||||||
|
type: string
|
||||||
|
satisfiable:
|
||||||
|
type: string
|
||||||
|
source:
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
uniqueId:
|
||||||
|
type: string
|
||||||
|
userId:
|
||||||
|
type: integer
|
||||||
|
workCompany:
|
||||||
|
type: string
|
||||||
|
workCompanyAccountantNumber:
|
||||||
|
type: string
|
||||||
|
workPosition:
|
||||||
|
type: string
|
||||||
|
workProvinceId:
|
||||||
|
type: integer
|
||||||
|
workRegion:
|
||||||
|
type: string
|
||||||
|
workSalary:
|
||||||
|
type: string
|
||||||
|
workStartedAt:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- bornAt
|
||||||
|
- bornPlace
|
||||||
|
- branchId
|
||||||
|
- customerName
|
||||||
|
- customerSurname
|
||||||
|
- education
|
||||||
|
- loanType
|
||||||
|
- marriageStatus
|
||||||
|
- passportAddress
|
||||||
|
- passportFour
|
||||||
|
- passportGivenAt
|
||||||
|
- passportGivenBy
|
||||||
|
- passportId
|
||||||
|
- passportOne
|
||||||
|
- passportSerie
|
||||||
|
- passportThree
|
||||||
|
- passportTwo
|
||||||
|
- phone
|
||||||
|
- realAddress
|
||||||
|
- region
|
||||||
|
type: object
|
||||||
|
loanorders.UpdateLoanOrderDTO:
|
||||||
|
properties:
|
||||||
|
bornAt:
|
||||||
|
type: string
|
||||||
|
bornPlace:
|
||||||
|
type: string
|
||||||
|
branchId:
|
||||||
|
type: integer
|
||||||
|
cardMonth:
|
||||||
|
type: string
|
||||||
|
cardName:
|
||||||
|
type: string
|
||||||
|
cardNumber:
|
||||||
|
type: string
|
||||||
|
cardYear:
|
||||||
|
type: string
|
||||||
|
customerName:
|
||||||
|
type: string
|
||||||
|
customerPatronicName:
|
||||||
|
type: string
|
||||||
|
customerSurname:
|
||||||
|
type: string
|
||||||
|
education:
|
||||||
|
type: string
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
guarantor2CardMonth:
|
||||||
|
type: string
|
||||||
|
guarantor2CardName:
|
||||||
|
type: string
|
||||||
|
guarantor2CardNumber:
|
||||||
|
type: string
|
||||||
|
guarantor2CardYear:
|
||||||
|
type: string
|
||||||
|
guarantor2Name:
|
||||||
|
type: string
|
||||||
|
guarantor2Note:
|
||||||
|
type: string
|
||||||
|
guarantor2PassportId:
|
||||||
|
type: string
|
||||||
|
guarantor2PassportSerie:
|
||||||
|
type: string
|
||||||
|
guarantor2PatronicName:
|
||||||
|
type: string
|
||||||
|
guarantor2Surname:
|
||||||
|
type: string
|
||||||
|
guarantorCardMonth:
|
||||||
|
type: string
|
||||||
|
guarantorCardName:
|
||||||
|
type: string
|
||||||
|
guarantorCardNumber:
|
||||||
|
type: string
|
||||||
|
guarantorCardYear:
|
||||||
|
type: string
|
||||||
|
guarantorName:
|
||||||
|
type: string
|
||||||
|
guarantorNote:
|
||||||
|
type: string
|
||||||
|
guarantorPassportId:
|
||||||
|
type: string
|
||||||
|
guarantorPassportSerie:
|
||||||
|
type: string
|
||||||
|
guarantorPatronicName:
|
||||||
|
type: string
|
||||||
|
guarantorSurname:
|
||||||
|
type: string
|
||||||
|
loanAmount:
|
||||||
|
type: string
|
||||||
|
loanCardMonth:
|
||||||
|
type: string
|
||||||
|
loanCardName:
|
||||||
|
type: string
|
||||||
|
loanCardNumber:
|
||||||
|
type: string
|
||||||
|
loanCardYear:
|
||||||
|
type: string
|
||||||
|
loanOrderRequiredDocId:
|
||||||
|
type: integer
|
||||||
|
loanType:
|
||||||
|
type: integer
|
||||||
|
marriageStatus:
|
||||||
|
type: string
|
||||||
|
notes:
|
||||||
|
type: string
|
||||||
|
passportAddress:
|
||||||
|
type: string
|
||||||
|
passportFour:
|
||||||
|
type: string
|
||||||
|
passportGivenAt:
|
||||||
|
type: string
|
||||||
|
passportGivenBy:
|
||||||
|
type: string
|
||||||
|
passportId:
|
||||||
|
type: string
|
||||||
|
passportOne:
|
||||||
|
type: string
|
||||||
|
passportSerie:
|
||||||
|
type: string
|
||||||
|
passportThree:
|
||||||
|
type: string
|
||||||
|
passportTwo:
|
||||||
|
type: string
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
phoneAdditional:
|
||||||
|
type: string
|
||||||
|
phoneHome:
|
||||||
|
type: string
|
||||||
|
realAddress:
|
||||||
|
type: string
|
||||||
|
region:
|
||||||
|
type: string
|
||||||
|
satisfiable:
|
||||||
|
type: string
|
||||||
|
source:
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
uniqueId:
|
||||||
|
type: string
|
||||||
|
userId:
|
||||||
|
type: integer
|
||||||
|
workCompany:
|
||||||
|
type: string
|
||||||
|
workCompanyAccountantNumber:
|
||||||
|
type: string
|
||||||
|
workPosition:
|
||||||
|
type: string
|
||||||
|
workProvinceId:
|
||||||
|
type: integer
|
||||||
|
workRegion:
|
||||||
|
type: string
|
||||||
|
workSalary:
|
||||||
|
type: string
|
||||||
|
workStartedAt:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- bornAt
|
||||||
|
- bornPlace
|
||||||
|
- branchId
|
||||||
|
- customerName
|
||||||
|
- customerSurname
|
||||||
|
- education
|
||||||
|
- loanType
|
||||||
|
- marriageStatus
|
||||||
|
- passportAddress
|
||||||
|
- passportFour
|
||||||
|
- passportGivenAt
|
||||||
|
- passportGivenBy
|
||||||
|
- passportId
|
||||||
|
- passportOne
|
||||||
|
- passportSerie
|
||||||
|
- passportThree
|
||||||
|
- passportTwo
|
||||||
|
- phone
|
||||||
|
- realAddress
|
||||||
|
- region
|
||||||
|
type: object
|
||||||
loansdocument.CreateLoanDocumentDTO:
|
loansdocument.CreateLoanDocumentDTO:
|
||||||
properties:
|
properties:
|
||||||
active:
|
active:
|
||||||
@@ -691,6 +1007,192 @@ paths:
|
|||||||
summary: Update branch
|
summary: Update branch
|
||||||
tags:
|
tags:
|
||||||
- branches
|
- branches
|
||||||
|
/loan-orders:
|
||||||
|
get:
|
||||||
|
description: Returns paginated loan orders with optional filters
|
||||||
|
parameters:
|
||||||
|
- description: Filter by status
|
||||||
|
in: query
|
||||||
|
name: status
|
||||||
|
type: string
|
||||||
|
- description: Filter by branch ID
|
||||||
|
in: query
|
||||||
|
name: branch_id
|
||||||
|
type: integer
|
||||||
|
- description: Filter by user ID
|
||||||
|
in: query
|
||||||
|
name: user_id
|
||||||
|
type: integer
|
||||||
|
- description: Filter by region
|
||||||
|
in: query
|
||||||
|
name: region
|
||||||
|
type: string
|
||||||
|
- default: 1
|
||||||
|
description: Page number
|
||||||
|
in: query
|
||||||
|
name: page
|
||||||
|
type: integer
|
||||||
|
- default: 10
|
||||||
|
description: Items per page
|
||||||
|
in: query
|
||||||
|
name: limit
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppSuccess'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: List loan orders
|
||||||
|
tags:
|
||||||
|
- loan-orders
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Creates a new loan order
|
||||||
|
parameters:
|
||||||
|
- description: Loan order payload
|
||||||
|
in: body
|
||||||
|
name: body
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/loanorders.CreateLoanOrderDTO'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: Created
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppSuccess'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Create loan order
|
||||||
|
tags:
|
||||||
|
- loan-orders
|
||||||
|
/loan-orders/{id}:
|
||||||
|
delete:
|
||||||
|
description: Deletes a loan order
|
||||||
|
parameters:
|
||||||
|
- description: Loan order ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppSuccess'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Delete loan order
|
||||||
|
tags:
|
||||||
|
- loan-orders
|
||||||
|
get:
|
||||||
|
description: Returns a single loan order
|
||||||
|
parameters:
|
||||||
|
- description: Loan order ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppSuccess'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Get loan order by ID
|
||||||
|
tags:
|
||||||
|
- loan-orders
|
||||||
|
put:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Updates an existing loan order
|
||||||
|
parameters:
|
||||||
|
- description: Loan order ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: Loan order payload
|
||||||
|
in: body
|
||||||
|
name: body
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/loanorders.UpdateLoanOrderDTO'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppSuccess'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/appresult.AppError'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Update loan order
|
||||||
|
tags:
|
||||||
|
- loan-orders
|
||||||
/loan-types:
|
/loan-types:
|
||||||
get:
|
get:
|
||||||
description: Returns paginated loan types with optional filters
|
description: Returns paginated loan types with optional filters
|
||||||
|
|||||||
251
internal/admin/loanorders/db/postgresql.go
Normal file
251
internal/admin/loanorders/db/postgresql.go
Normal file
@@ -0,0 +1,251 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"online-back/internal/admin/loanorders"
|
||||||
|
"online-back/pkg/client/postgresql"
|
||||||
|
"online-back/pkg/logging"
|
||||||
|
|
||||||
|
"github.com/jackc/pgx/v4"
|
||||||
|
)
|
||||||
|
|
||||||
|
type repository struct {
|
||||||
|
client postgresql.Client
|
||||||
|
logger *logging.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRepository(client postgresql.Client, logger *logging.Logger) loanorders.Repository {
|
||||||
|
return &repository{client: client, logger: logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
// loanOrderWritableColumns lists every loan_orders column except id, created_at and
|
||||||
|
// updated_at, in the exact order CreateLoanOrderDTO/UpdateLoanOrderDTO fields are read.
|
||||||
|
var loanOrderWritableColumns = []string{
|
||||||
|
"unique_id", "source", "user_id", "loan_type", "region", "branch_id",
|
||||||
|
"customer_name", "customer_surname", "customer_patronic_name",
|
||||||
|
"passport_address", "real_address", "passport_serie", "passport_id", "passport_given_at", "passport_given_by",
|
||||||
|
"born_place", "born_at", "email", "phone", "phone_additional", "phone_home",
|
||||||
|
"work_region", "work_province_id", "work_company", "work_company_accountant_number", "work_started_at",
|
||||||
|
"work_salary", "work_position", "education", "marriage_status",
|
||||||
|
"passport_one", "passport_two", "passport_three", "passport_four",
|
||||||
|
"loan_amount", "card_number", "card_name", "card_month", "card_year",
|
||||||
|
"guarantor_name", "guarantor_surname", "guarantor_patronic_name", "guarantor_passport_serie", "guarantor_passport_id",
|
||||||
|
"guarantor_card_number", "guarantor_card_name", "guarantor_card_month", "guarantor_card_year", "guarantor_note",
|
||||||
|
"guarantor_2_name", "guarantor_2_surname", "guarantor_2_patronic_name", "guarantor_2_passport_serie", "guarantor_2_passport_id",
|
||||||
|
"guarantor_2_card_number", "guarantor_2_card_name", "guarantor_2_card_month", "guarantor_2_card_year", "guarantor_2_note",
|
||||||
|
"loan_card_number", "loan_card_name", "loan_card_month", "loan_card_year",
|
||||||
|
"loan_order_required_doc_id", "status", "satisfiable", "notes",
|
||||||
|
}
|
||||||
|
|
||||||
|
var loanOrderColumns = append(append([]string{"id"}, loanOrderWritableColumns...), "created_at", "updated_at")
|
||||||
|
|
||||||
|
var loanOrderColumnsSQL = strings.Join(loanOrderColumns, ", ")
|
||||||
|
|
||||||
|
var loanOrderWritableColumnsSQL = strings.Join(loanOrderWritableColumns, ", ")
|
||||||
|
|
||||||
|
func resolveSource(source string) string {
|
||||||
|
source = strings.TrimSpace(source)
|
||||||
|
if source == "" {
|
||||||
|
return "web"
|
||||||
|
}
|
||||||
|
return source
|
||||||
|
}
|
||||||
|
|
||||||
|
func createArgs(dto loanorders.CreateLoanOrderDTO) []interface{} {
|
||||||
|
return []interface{}{
|
||||||
|
dto.UniqueId, resolveSource(dto.Source), dto.UserId, dto.LoanType, dto.Region, dto.BranchId,
|
||||||
|
dto.CustomerName, dto.CustomerSurname, dto.CustomerPatronicName,
|
||||||
|
dto.PassportAddress, dto.RealAddress, dto.PassportSerie, dto.PassportId, dto.PassportGivenAt, dto.PassportGivenBy,
|
||||||
|
dto.BornPlace, dto.BornAt, dto.Email, dto.Phone, dto.PhoneAdditional, dto.PhoneHome,
|
||||||
|
dto.WorkRegion, dto.WorkProvinceId, dto.WorkCompany, dto.WorkCompanyAccountantNumber, dto.WorkStartedAt,
|
||||||
|
dto.WorkSalary, dto.WorkPosition, dto.Education, dto.MarriageStatus,
|
||||||
|
dto.PassportOne, dto.PassportTwo, dto.PassportThree, dto.PassportFour,
|
||||||
|
dto.LoanAmount, dto.CardNumber, dto.CardName, dto.CardMonth, dto.CardYear,
|
||||||
|
dto.GuarantorName, dto.GuarantorSurname, dto.GuarantorPatronicName, dto.GuarantorPassportSerie, dto.GuarantorPassportId,
|
||||||
|
dto.GuarantorCardNumber, dto.GuarantorCardName, dto.GuarantorCardMonth, dto.GuarantorCardYear, dto.GuarantorNote,
|
||||||
|
dto.Guarantor2Name, dto.Guarantor2Surname, dto.Guarantor2PatronicName, dto.Guarantor2PassportSerie, dto.Guarantor2PassportId,
|
||||||
|
dto.Guarantor2CardNumber, dto.Guarantor2CardName, dto.Guarantor2CardMonth, dto.Guarantor2CardYear, dto.Guarantor2Note,
|
||||||
|
dto.LoanCardNumber, dto.LoanCardName, dto.LoanCardMonth, dto.LoanCardYear,
|
||||||
|
dto.LoanOrderRequiredDocId, dto.Status, dto.Satisfiable, dto.Notes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateArgs(dto loanorders.UpdateLoanOrderDTO) []interface{} {
|
||||||
|
return []interface{}{
|
||||||
|
dto.UniqueId, resolveSource(dto.Source), dto.UserId, dto.LoanType, dto.Region, dto.BranchId,
|
||||||
|
dto.CustomerName, dto.CustomerSurname, dto.CustomerPatronicName,
|
||||||
|
dto.PassportAddress, dto.RealAddress, dto.PassportSerie, dto.PassportId, dto.PassportGivenAt, dto.PassportGivenBy,
|
||||||
|
dto.BornPlace, dto.BornAt, dto.Email, dto.Phone, dto.PhoneAdditional, dto.PhoneHome,
|
||||||
|
dto.WorkRegion, dto.WorkProvinceId, dto.WorkCompany, dto.WorkCompanyAccountantNumber, dto.WorkStartedAt,
|
||||||
|
dto.WorkSalary, dto.WorkPosition, dto.Education, dto.MarriageStatus,
|
||||||
|
dto.PassportOne, dto.PassportTwo, dto.PassportThree, dto.PassportFour,
|
||||||
|
dto.LoanAmount, dto.CardNumber, dto.CardName, dto.CardMonth, dto.CardYear,
|
||||||
|
dto.GuarantorName, dto.GuarantorSurname, dto.GuarantorPatronicName, dto.GuarantorPassportSerie, dto.GuarantorPassportId,
|
||||||
|
dto.GuarantorCardNumber, dto.GuarantorCardName, dto.GuarantorCardMonth, dto.GuarantorCardYear, dto.GuarantorNote,
|
||||||
|
dto.Guarantor2Name, dto.Guarantor2Surname, dto.Guarantor2PatronicName, dto.Guarantor2PassportSerie, dto.Guarantor2PassportId,
|
||||||
|
dto.Guarantor2CardNumber, dto.Guarantor2CardName, dto.Guarantor2CardMonth, dto.Guarantor2CardYear, dto.Guarantor2Note,
|
||||||
|
dto.LoanCardNumber, dto.LoanCardName, dto.LoanCardMonth, dto.LoanCardYear,
|
||||||
|
dto.LoanOrderRequiredDocId, dto.Status, dto.Satisfiable, dto.Notes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *repository) List(ctx context.Context, filter loanorders.ListFilter) (loanorders.ListLoanOrderDTO, error) {
|
||||||
|
whereClause, args := buildListQuery(filter)
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
countQuery := `SELECT COUNT(*) FROM loan_orders` + whereClause
|
||||||
|
if err := r.client.QueryRow(ctx, countQuery, args...).Scan(&count); err != nil {
|
||||||
|
return loanorders.ListLoanOrderDTO{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
offset := (filter.Page - 1) * filter.Limit
|
||||||
|
limitPlaceholder := len(args) + 1
|
||||||
|
offsetPlaceholder := len(args) + 2
|
||||||
|
listQuery := fmt.Sprintf(
|
||||||
|
`SELECT %s FROM loan_orders%s ORDER BY id DESC LIMIT $%d OFFSET $%d`,
|
||||||
|
loanOrderColumnsSQL, whereClause, limitPlaceholder, offsetPlaceholder,
|
||||||
|
)
|
||||||
|
|
||||||
|
rows, err := r.client.Query(ctx, listQuery, append(args, filter.Limit, offset)...)
|
||||||
|
if err != nil {
|
||||||
|
return loanorders.ListLoanOrderDTO{}, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
var items []loanorders.LoanOrderDTO
|
||||||
|
for rows.Next() {
|
||||||
|
item, err := scanLoanOrder(rows)
|
||||||
|
if err != nil {
|
||||||
|
return loanorders.ListLoanOrderDTO{}, err
|
||||||
|
}
|
||||||
|
items = append(items, item)
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return loanorders.ListLoanOrderDTO{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return loanorders.ListLoanOrderDTO{Count: count, LoanOrders: items}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildListQuery(filter loanorders.ListFilter) (whereClause string, args []interface{}) {
|
||||||
|
var conditions []string
|
||||||
|
|
||||||
|
if filter.Status != nil {
|
||||||
|
args = append(args, *filter.Status)
|
||||||
|
conditions = append(conditions, fmt.Sprintf("status = $%d", len(args)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if filter.BranchId != nil {
|
||||||
|
args = append(args, *filter.BranchId)
|
||||||
|
conditions = append(conditions, fmt.Sprintf("branch_id = $%d", len(args)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if filter.UserId != nil {
|
||||||
|
args = append(args, *filter.UserId)
|
||||||
|
conditions = append(conditions, fmt.Sprintf("user_id = $%d", len(args)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if filter.Region != "" {
|
||||||
|
args = append(args, filter.Region)
|
||||||
|
conditions = append(conditions, fmt.Sprintf("region = $%d", len(args)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(conditions) == 0 {
|
||||||
|
return "", args
|
||||||
|
}
|
||||||
|
|
||||||
|
return " WHERE " + strings.Join(conditions, " AND "), args
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *repository) GetByID(ctx context.Context, id int64) (loanorders.LoanOrderDTO, error) {
|
||||||
|
query := fmt.Sprintf(`SELECT %s FROM loan_orders WHERE id = $1`, loanOrderColumnsSQL)
|
||||||
|
item, err := scanLoanOrder(r.client.QueryRow(ctx, query, id))
|
||||||
|
if err != nil {
|
||||||
|
return loanorders.LoanOrderDTO{}, err
|
||||||
|
}
|
||||||
|
return item, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// nextUniqueIDSQL computes unique_id as the last value stored in loan_orders plus
|
||||||
|
// one, zero-padded to 4 digits, mirroring a serial/auto-increment column.
|
||||||
|
const nextUniqueIDSQL = `(SELECT LPAD((COALESCE(MAX(unique_id::bigint), 0) + 1)::text, 4, '0') FROM loan_orders)`
|
||||||
|
|
||||||
|
func (r *repository) Create(ctx context.Context, dto loanorders.CreateLoanOrderDTO) (loanorders.LoanOrderDTO, error) {
|
||||||
|
args := createArgs(dto)
|
||||||
|
|
||||||
|
placeholders := make([]string, len(args))
|
||||||
|
for i := range args {
|
||||||
|
placeholders[i] = fmt.Sprintf("$%d", i+1)
|
||||||
|
}
|
||||||
|
|
||||||
|
query := fmt.Sprintf(
|
||||||
|
`INSERT INTO loan_orders (%s) VALUES (%s, %s) RETURNING %s`,
|
||||||
|
loanOrderWritableColumnsSQL, nextUniqueIDSQL, strings.Join(placeholders, ", "), loanOrderColumnsSQL,
|
||||||
|
)
|
||||||
|
|
||||||
|
return scanLoanOrder(r.client.QueryRow(ctx, query, args...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *repository) Update(ctx context.Context, id int64, dto loanorders.UpdateLoanOrderDTO) (loanorders.LoanOrderDTO, error) {
|
||||||
|
args := updateArgs(dto)
|
||||||
|
|
||||||
|
assignments := make([]string, len(loanOrderWritableColumns))
|
||||||
|
for i, column := range loanOrderWritableColumns {
|
||||||
|
assignments[i] = fmt.Sprintf("%s = $%d", column, i+1)
|
||||||
|
}
|
||||||
|
args = append(args, id)
|
||||||
|
|
||||||
|
query := fmt.Sprintf(
|
||||||
|
`UPDATE loan_orders SET %s, updated_at = (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') WHERE id = $%d RETURNING %s`,
|
||||||
|
strings.Join(assignments, ", "), len(args), loanOrderColumnsSQL,
|
||||||
|
)
|
||||||
|
|
||||||
|
item, err := scanLoanOrder(r.client.QueryRow(ctx, query, args...))
|
||||||
|
if err != nil {
|
||||||
|
return loanorders.LoanOrderDTO{}, err
|
||||||
|
}
|
||||||
|
return item, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *repository) Delete(ctx context.Context, id int64) error {
|
||||||
|
tag, err := r.client.Exec(ctx, `DELETE FROM loan_orders WHERE id = $1`, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if tag.RowsAffected() == 0 {
|
||||||
|
return pgx.ErrNoRows
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type scannable interface {
|
||||||
|
Scan(dest ...interface{}) error
|
||||||
|
}
|
||||||
|
|
||||||
|
func scanLoanOrder(row scannable) (loanorders.LoanOrderDTO, error) {
|
||||||
|
var item loanorders.LoanOrderDTO
|
||||||
|
err := row.Scan(
|
||||||
|
&item.Id, &item.UniqueId, &item.Source, &item.UserId, &item.LoanType, &item.Region, &item.BranchId,
|
||||||
|
&item.CustomerName, &item.CustomerSurname, &item.CustomerPatronicName,
|
||||||
|
&item.PassportAddress, &item.RealAddress, &item.PassportSerie, &item.PassportId, &item.PassportGivenAt, &item.PassportGivenBy,
|
||||||
|
&item.BornPlace, &item.BornAt, &item.Email, &item.Phone, &item.PhoneAdditional, &item.PhoneHome,
|
||||||
|
&item.WorkRegion, &item.WorkProvinceId, &item.WorkCompany, &item.WorkCompanyAccountantNumber, &item.WorkStartedAt,
|
||||||
|
&item.WorkSalary, &item.WorkPosition, &item.Education, &item.MarriageStatus,
|
||||||
|
&item.PassportOne, &item.PassportTwo, &item.PassportThree, &item.PassportFour,
|
||||||
|
&item.LoanAmount, &item.CardNumber, &item.CardName, &item.CardMonth, &item.CardYear,
|
||||||
|
&item.GuarantorName, &item.GuarantorSurname, &item.GuarantorPatronicName, &item.GuarantorPassportSerie, &item.GuarantorPassportId,
|
||||||
|
&item.GuarantorCardNumber, &item.GuarantorCardName, &item.GuarantorCardMonth, &item.GuarantorCardYear, &item.GuarantorNote,
|
||||||
|
&item.Guarantor2Name, &item.Guarantor2Surname, &item.Guarantor2PatronicName, &item.Guarantor2PassportSerie, &item.Guarantor2PassportId,
|
||||||
|
&item.Guarantor2CardNumber, &item.Guarantor2CardName, &item.Guarantor2CardMonth, &item.Guarantor2CardYear, &item.Guarantor2Note,
|
||||||
|
&item.LoanCardNumber, &item.LoanCardName, &item.LoanCardMonth, &item.LoanCardYear,
|
||||||
|
&item.LoanOrderRequiredDocId, &item.Status, &item.Satisfiable, &item.Notes,
|
||||||
|
&item.CreatedAt, &item.UpdatedAt,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return loanorders.LoanOrderDTO{}, err
|
||||||
|
}
|
||||||
|
return item, nil
|
||||||
|
}
|
||||||
230
internal/admin/loanorders/dto.go
Normal file
230
internal/admin/loanorders/dto.go
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
package loanorders
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type LoanOrderDTO struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
UniqueId *string `json:"uniqueId"`
|
||||||
|
Source string `json:"source"`
|
||||||
|
UserId *int64 `json:"userId"`
|
||||||
|
LoanType int64 `json:"loanType"`
|
||||||
|
Region string `json:"region"`
|
||||||
|
BranchId int64 `json:"branchId"`
|
||||||
|
CustomerName string `json:"customerName"`
|
||||||
|
CustomerSurname string `json:"customerSurname"`
|
||||||
|
CustomerPatronicName *string `json:"customerPatronicName"`
|
||||||
|
PassportAddress string `json:"passportAddress"`
|
||||||
|
RealAddress string `json:"realAddress"`
|
||||||
|
PassportSerie string `json:"passportSerie"`
|
||||||
|
PassportId string `json:"passportId"`
|
||||||
|
PassportGivenAt time.Time `json:"passportGivenAt"`
|
||||||
|
PassportGivenBy string `json:"passportGivenBy"`
|
||||||
|
BornPlace string `json:"bornPlace"`
|
||||||
|
BornAt time.Time `json:"bornAt"`
|
||||||
|
Email *string `json:"email"`
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
PhoneAdditional *string `json:"phoneAdditional"`
|
||||||
|
PhoneHome *string `json:"phoneHome"`
|
||||||
|
WorkRegion *string `json:"workRegion"`
|
||||||
|
WorkProvinceId *int64 `json:"workProvinceId"`
|
||||||
|
WorkCompany *string `json:"workCompany"`
|
||||||
|
WorkCompanyAccountantNumber *string `json:"workCompanyAccountantNumber"`
|
||||||
|
WorkStartedAt *time.Time `json:"workStartedAt"`
|
||||||
|
WorkSalary *string `json:"workSalary"`
|
||||||
|
WorkPosition *string `json:"workPosition"`
|
||||||
|
Education string `json:"education"`
|
||||||
|
MarriageStatus string `json:"marriageStatus"`
|
||||||
|
PassportOne string `json:"passportOne"`
|
||||||
|
PassportTwo string `json:"passportTwo"`
|
||||||
|
PassportThree string `json:"passportThree"`
|
||||||
|
PassportFour string `json:"passportFour"`
|
||||||
|
LoanAmount *string `json:"loanAmount"`
|
||||||
|
CardNumber *string `json:"cardNumber"`
|
||||||
|
CardName *string `json:"cardName"`
|
||||||
|
CardMonth *string `json:"cardMonth"`
|
||||||
|
CardYear *string `json:"cardYear"`
|
||||||
|
GuarantorName *string `json:"guarantorName"`
|
||||||
|
GuarantorSurname *string `json:"guarantorSurname"`
|
||||||
|
GuarantorPatronicName *string `json:"guarantorPatronicName"`
|
||||||
|
GuarantorPassportSerie *string `json:"guarantorPassportSerie"`
|
||||||
|
GuarantorPassportId *string `json:"guarantorPassportId"`
|
||||||
|
GuarantorCardNumber *string `json:"guarantorCardNumber"`
|
||||||
|
GuarantorCardName *string `json:"guarantorCardName"`
|
||||||
|
GuarantorCardMonth *string `json:"guarantorCardMonth"`
|
||||||
|
GuarantorCardYear *string `json:"guarantorCardYear"`
|
||||||
|
GuarantorNote *string `json:"guarantorNote"`
|
||||||
|
Guarantor2Name *string `json:"guarantor2Name"`
|
||||||
|
Guarantor2Surname *string `json:"guarantor2Surname"`
|
||||||
|
Guarantor2PatronicName *string `json:"guarantor2PatronicName"`
|
||||||
|
Guarantor2PassportSerie *string `json:"guarantor2PassportSerie"`
|
||||||
|
Guarantor2PassportId *string `json:"guarantor2PassportId"`
|
||||||
|
Guarantor2CardNumber *string `json:"guarantor2CardNumber"`
|
||||||
|
Guarantor2CardName *string `json:"guarantor2CardName"`
|
||||||
|
Guarantor2CardMonth *string `json:"guarantor2CardMonth"`
|
||||||
|
Guarantor2CardYear *string `json:"guarantor2CardYear"`
|
||||||
|
Guarantor2Note *string `json:"guarantor2Note"`
|
||||||
|
LoanCardNumber *string `json:"loanCardNumber"`
|
||||||
|
LoanCardName *string `json:"loanCardName"`
|
||||||
|
LoanCardMonth *string `json:"loanCardMonth"`
|
||||||
|
LoanCardYear *string `json:"loanCardYear"`
|
||||||
|
LoanOrderRequiredDocId *int64 `json:"loanOrderRequiredDocId"`
|
||||||
|
Status *string `json:"status"`
|
||||||
|
Satisfiable *string `json:"satisfiable"`
|
||||||
|
Notes *string `json:"notes"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateLoanOrderDTO struct {
|
||||||
|
Source string `json:"source"`
|
||||||
|
UserId *int64 `json:"userId"`
|
||||||
|
UniqueId *string `json:"uniqueId"`
|
||||||
|
LoanType int64 `json:"loanType" binding:"required"`
|
||||||
|
Region string `json:"region" binding:"required"`
|
||||||
|
BranchId int64 `json:"branchId" binding:"required"`
|
||||||
|
CustomerName string `json:"customerName" binding:"required"`
|
||||||
|
CustomerSurname string `json:"customerSurname" binding:"required"`
|
||||||
|
CustomerPatronicName *string `json:"customerPatronicName"`
|
||||||
|
PassportAddress string `json:"passportAddress" binding:"required"`
|
||||||
|
RealAddress string `json:"realAddress" binding:"required"`
|
||||||
|
PassportSerie string `json:"passportSerie" binding:"required"`
|
||||||
|
PassportId string `json:"passportId" binding:"required"`
|
||||||
|
PassportGivenAt time.Time `json:"passportGivenAt" binding:"required"`
|
||||||
|
PassportGivenBy string `json:"passportGivenBy" binding:"required"`
|
||||||
|
BornPlace string `json:"bornPlace" binding:"required"`
|
||||||
|
BornAt time.Time `json:"bornAt" binding:"required"`
|
||||||
|
Email *string `json:"email"`
|
||||||
|
Phone string `json:"phone" binding:"required"`
|
||||||
|
PhoneAdditional *string `json:"phoneAdditional"`
|
||||||
|
PhoneHome *string `json:"phoneHome"`
|
||||||
|
WorkRegion *string `json:"workRegion"`
|
||||||
|
WorkProvinceId *int64 `json:"workProvinceId"`
|
||||||
|
WorkCompany *string `json:"workCompany"`
|
||||||
|
WorkCompanyAccountantNumber *string `json:"workCompanyAccountantNumber"`
|
||||||
|
WorkStartedAt *time.Time `json:"workStartedAt"`
|
||||||
|
WorkSalary *string `json:"workSalary"`
|
||||||
|
WorkPosition *string `json:"workPosition"`
|
||||||
|
Education string `json:"education" binding:"required"`
|
||||||
|
MarriageStatus string `json:"marriageStatus" binding:"required"`
|
||||||
|
PassportOne string `json:"passportOne" binding:"required"`
|
||||||
|
PassportTwo string `json:"passportTwo" binding:"required"`
|
||||||
|
PassportThree string `json:"passportThree" binding:"required"`
|
||||||
|
PassportFour string `json:"passportFour" binding:"required"`
|
||||||
|
LoanAmount *string `json:"loanAmount"`
|
||||||
|
CardNumber *string `json:"cardNumber"`
|
||||||
|
CardName *string `json:"cardName"`
|
||||||
|
CardMonth *string `json:"cardMonth"`
|
||||||
|
CardYear *string `json:"cardYear"`
|
||||||
|
GuarantorName *string `json:"guarantorName"`
|
||||||
|
GuarantorSurname *string `json:"guarantorSurname"`
|
||||||
|
GuarantorPatronicName *string `json:"guarantorPatronicName"`
|
||||||
|
GuarantorPassportSerie *string `json:"guarantorPassportSerie"`
|
||||||
|
GuarantorPassportId *string `json:"guarantorPassportId"`
|
||||||
|
GuarantorCardNumber *string `json:"guarantorCardNumber"`
|
||||||
|
GuarantorCardName *string `json:"guarantorCardName"`
|
||||||
|
GuarantorCardMonth *string `json:"guarantorCardMonth"`
|
||||||
|
GuarantorCardYear *string `json:"guarantorCardYear"`
|
||||||
|
GuarantorNote *string `json:"guarantorNote"`
|
||||||
|
Guarantor2Name *string `json:"guarantor2Name"`
|
||||||
|
Guarantor2Surname *string `json:"guarantor2Surname"`
|
||||||
|
Guarantor2PatronicName *string `json:"guarantor2PatronicName"`
|
||||||
|
Guarantor2PassportSerie *string `json:"guarantor2PassportSerie"`
|
||||||
|
Guarantor2PassportId *string `json:"guarantor2PassportId"`
|
||||||
|
Guarantor2CardNumber *string `json:"guarantor2CardNumber"`
|
||||||
|
Guarantor2CardName *string `json:"guarantor2CardName"`
|
||||||
|
Guarantor2CardMonth *string `json:"guarantor2CardMonth"`
|
||||||
|
Guarantor2CardYear *string `json:"guarantor2CardYear"`
|
||||||
|
Guarantor2Note *string `json:"guarantor2Note"`
|
||||||
|
LoanCardNumber *string `json:"loanCardNumber"`
|
||||||
|
LoanCardName *string `json:"loanCardName"`
|
||||||
|
LoanCardMonth *string `json:"loanCardMonth"`
|
||||||
|
LoanCardYear *string `json:"loanCardYear"`
|
||||||
|
LoanOrderRequiredDocId *int64 `json:"loanOrderRequiredDocId"`
|
||||||
|
Status *string `json:"status"`
|
||||||
|
Satisfiable *string `json:"satisfiable"`
|
||||||
|
Notes *string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateLoanOrderDTO struct {
|
||||||
|
UniqueId *string `json:"uniqueId"`
|
||||||
|
Source string `json:"source"`
|
||||||
|
UserId *int64 `json:"userId"`
|
||||||
|
LoanType int64 `json:"loanType" binding:"required"`
|
||||||
|
Region string `json:"region" binding:"required"`
|
||||||
|
BranchId int64 `json:"branchId" binding:"required"`
|
||||||
|
CustomerName string `json:"customerName" binding:"required"`
|
||||||
|
CustomerSurname string `json:"customerSurname" binding:"required"`
|
||||||
|
CustomerPatronicName *string `json:"customerPatronicName"`
|
||||||
|
PassportAddress string `json:"passportAddress" binding:"required"`
|
||||||
|
RealAddress string `json:"realAddress" binding:"required"`
|
||||||
|
PassportSerie string `json:"passportSerie" binding:"required"`
|
||||||
|
PassportId string `json:"passportId" binding:"required"`
|
||||||
|
PassportGivenAt time.Time `json:"passportGivenAt" binding:"required"`
|
||||||
|
PassportGivenBy string `json:"passportGivenBy" binding:"required"`
|
||||||
|
BornPlace string `json:"bornPlace" binding:"required"`
|
||||||
|
BornAt time.Time `json:"bornAt" binding:"required"`
|
||||||
|
Email *string `json:"email"`
|
||||||
|
Phone string `json:"phone" binding:"required"`
|
||||||
|
PhoneAdditional *string `json:"phoneAdditional"`
|
||||||
|
PhoneHome *string `json:"phoneHome"`
|
||||||
|
WorkRegion *string `json:"workRegion"`
|
||||||
|
WorkProvinceId *int64 `json:"workProvinceId"`
|
||||||
|
WorkCompany *string `json:"workCompany"`
|
||||||
|
WorkCompanyAccountantNumber *string `json:"workCompanyAccountantNumber"`
|
||||||
|
WorkStartedAt *time.Time `json:"workStartedAt"`
|
||||||
|
WorkSalary *string `json:"workSalary"`
|
||||||
|
WorkPosition *string `json:"workPosition"`
|
||||||
|
Education string `json:"education" binding:"required"`
|
||||||
|
MarriageStatus string `json:"marriageStatus" binding:"required"`
|
||||||
|
PassportOne string `json:"passportOne" binding:"required"`
|
||||||
|
PassportTwo string `json:"passportTwo" binding:"required"`
|
||||||
|
PassportThree string `json:"passportThree" binding:"required"`
|
||||||
|
PassportFour string `json:"passportFour" binding:"required"`
|
||||||
|
LoanAmount *string `json:"loanAmount"`
|
||||||
|
CardNumber *string `json:"cardNumber"`
|
||||||
|
CardName *string `json:"cardName"`
|
||||||
|
CardMonth *string `json:"cardMonth"`
|
||||||
|
CardYear *string `json:"cardYear"`
|
||||||
|
GuarantorName *string `json:"guarantorName"`
|
||||||
|
GuarantorSurname *string `json:"guarantorSurname"`
|
||||||
|
GuarantorPatronicName *string `json:"guarantorPatronicName"`
|
||||||
|
GuarantorPassportSerie *string `json:"guarantorPassportSerie"`
|
||||||
|
GuarantorPassportId *string `json:"guarantorPassportId"`
|
||||||
|
GuarantorCardNumber *string `json:"guarantorCardNumber"`
|
||||||
|
GuarantorCardName *string `json:"guarantorCardName"`
|
||||||
|
GuarantorCardMonth *string `json:"guarantorCardMonth"`
|
||||||
|
GuarantorCardYear *string `json:"guarantorCardYear"`
|
||||||
|
GuarantorNote *string `json:"guarantorNote"`
|
||||||
|
Guarantor2Name *string `json:"guarantor2Name"`
|
||||||
|
Guarantor2Surname *string `json:"guarantor2Surname"`
|
||||||
|
Guarantor2PatronicName *string `json:"guarantor2PatronicName"`
|
||||||
|
Guarantor2PassportSerie *string `json:"guarantor2PassportSerie"`
|
||||||
|
Guarantor2PassportId *string `json:"guarantor2PassportId"`
|
||||||
|
Guarantor2CardNumber *string `json:"guarantor2CardNumber"`
|
||||||
|
Guarantor2CardName *string `json:"guarantor2CardName"`
|
||||||
|
Guarantor2CardMonth *string `json:"guarantor2CardMonth"`
|
||||||
|
Guarantor2CardYear *string `json:"guarantor2CardYear"`
|
||||||
|
Guarantor2Note *string `json:"guarantor2Note"`
|
||||||
|
LoanCardNumber *string `json:"loanCardNumber"`
|
||||||
|
LoanCardName *string `json:"loanCardName"`
|
||||||
|
LoanCardMonth *string `json:"loanCardMonth"`
|
||||||
|
LoanCardYear *string `json:"loanCardYear"`
|
||||||
|
LoanOrderRequiredDocId *int64 `json:"loanOrderRequiredDocId"`
|
||||||
|
Status *string `json:"status"`
|
||||||
|
Satisfiable *string `json:"satisfiable"`
|
||||||
|
Notes *string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListFilter struct {
|
||||||
|
Status *string
|
||||||
|
BranchId *int64
|
||||||
|
UserId *int64
|
||||||
|
Region string
|
||||||
|
Page int
|
||||||
|
Limit int
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListLoanOrderDTO struct {
|
||||||
|
Count int64 `json:"count"`
|
||||||
|
LoanOrders []LoanOrderDTO `json:"loanOrders"`
|
||||||
|
}
|
||||||
265
internal/admin/loanorders/handler.go
Normal file
265
internal/admin/loanorders/handler.go
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
package loanorders
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"online-back/internal/appresult"
|
||||||
|
"online-back/internal/handlers"
|
||||||
|
"online-back/pkg/logging"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/jackc/pgx/v4"
|
||||||
|
)
|
||||||
|
|
||||||
|
const baseURL = "/loan-orders"
|
||||||
|
|
||||||
|
type handler struct {
|
||||||
|
logger *logging.Logger
|
||||||
|
repository Repository
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewHandler(logger *logging.Logger, repository Repository) handlers.Handler {
|
||||||
|
return &handler{logger: logger, repository: repository}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *handler) Register(router *gin.RouterGroup) {
|
||||||
|
group := router.Group(baseURL, appresult.JwtTokenCheck())
|
||||||
|
group.GET("", h.list)
|
||||||
|
group.GET("/:id", h.getByID)
|
||||||
|
group.POST("", h.create)
|
||||||
|
group.PUT("/:id", h.update)
|
||||||
|
group.DELETE("/:id", h.delete)
|
||||||
|
}
|
||||||
|
|
||||||
|
// list godoc
|
||||||
|
// @Summary List loan orders
|
||||||
|
// @Description Returns paginated loan orders with optional filters
|
||||||
|
// @Tags loan-orders
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Param status query string false "Filter by status"
|
||||||
|
// @Param branch_id query int false "Filter by branch ID"
|
||||||
|
// @Param user_id query int false "Filter by user ID"
|
||||||
|
// @Param region query string false "Filter by region"
|
||||||
|
// @Param page query int false "Page number" default(1)
|
||||||
|
// @Param limit query int false "Items per page" default(10)
|
||||||
|
// @Success 200 {object} appresult.AppSuccess
|
||||||
|
// @Failure 400 {object} appresult.AppError
|
||||||
|
// @Failure 500 {object} appresult.AppError
|
||||||
|
// @Router /loan-orders [get]
|
||||||
|
func (h *handler) list(c *gin.Context) {
|
||||||
|
filter, ok := parseListFilter(c)
|
||||||
|
if !ok {
|
||||||
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := h.repository.List(c.Request.Context(), filter)
|
||||||
|
if err != nil {
|
||||||
|
h.logger.Errorf("list loan orders failed: %v", err)
|
||||||
|
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, appresult.SuccessWithData(result))
|
||||||
|
}
|
||||||
|
|
||||||
|
// getByID godoc
|
||||||
|
// @Summary Get loan order by ID
|
||||||
|
// @Description Returns a single loan order
|
||||||
|
// @Tags loan-orders
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Param id path int true "Loan order ID"
|
||||||
|
// @Success 200 {object} appresult.AppSuccess
|
||||||
|
// @Failure 400 {object} appresult.AppError
|
||||||
|
// @Failure 404 {object} appresult.AppError
|
||||||
|
// @Failure 500 {object} appresult.AppError
|
||||||
|
// @Router /loan-orders/{id} [get]
|
||||||
|
func (h *handler) getByID(c *gin.Context) {
|
||||||
|
id, ok := parseID(c.Param("id"))
|
||||||
|
if !ok {
|
||||||
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
item, err := h.repository.GetByID(c.Request.Context(), id)
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
c.JSON(http.StatusNotFound, appresult.ErrNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
h.logger.Errorf("get loan order failed: %v", err)
|
||||||
|
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, appresult.SuccessWithData(item))
|
||||||
|
}
|
||||||
|
|
||||||
|
// create godoc
|
||||||
|
// @Summary Create loan order
|
||||||
|
// @Description Creates a new loan order
|
||||||
|
// @Tags loan-orders
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Param body body CreateLoanOrderDTO true "Loan order payload"
|
||||||
|
// @Success 201 {object} appresult.AppSuccess
|
||||||
|
// @Failure 400 {object} appresult.AppError
|
||||||
|
// @Failure 500 {object} appresult.AppError
|
||||||
|
// @Router /loan-orders [post]
|
||||||
|
func (h *handler) create(c *gin.Context) {
|
||||||
|
var dto CreateLoanOrderDTO
|
||||||
|
if err := c.ShouldBindJSON(&dto); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
item, err := h.repository.Create(c.Request.Context(), dto)
|
||||||
|
if err != nil {
|
||||||
|
h.logger.Errorf("create loan order failed: %v", err)
|
||||||
|
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusCreated, appresult.SuccessWithData(item))
|
||||||
|
}
|
||||||
|
|
||||||
|
// update godoc
|
||||||
|
// @Summary Update loan order
|
||||||
|
// @Description Updates an existing loan order
|
||||||
|
// @Tags loan-orders
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Param id path int true "Loan order ID"
|
||||||
|
// @Param body body UpdateLoanOrderDTO true "Loan order payload"
|
||||||
|
// @Success 200 {object} appresult.AppSuccess
|
||||||
|
// @Failure 400 {object} appresult.AppError
|
||||||
|
// @Failure 404 {object} appresult.AppError
|
||||||
|
// @Failure 500 {object} appresult.AppError
|
||||||
|
// @Router /loan-orders/{id} [put]
|
||||||
|
func (h *handler) update(c *gin.Context) {
|
||||||
|
id, ok := parseID(c.Param("id"))
|
||||||
|
if !ok {
|
||||||
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var dto UpdateLoanOrderDTO
|
||||||
|
if err := c.ShouldBindJSON(&dto); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
item, err := h.repository.Update(c.Request.Context(), id, dto)
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
c.JSON(http.StatusNotFound, appresult.ErrNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
h.logger.Errorf("update loan order failed: %v", err)
|
||||||
|
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, appresult.SuccessWithData(item))
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete godoc
|
||||||
|
// @Summary Delete loan order
|
||||||
|
// @Description Deletes a loan order
|
||||||
|
// @Tags loan-orders
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Param id path int true "Loan order ID"
|
||||||
|
// @Success 200 {object} appresult.AppSuccess
|
||||||
|
// @Failure 400 {object} appresult.AppError
|
||||||
|
// @Failure 404 {object} appresult.AppError
|
||||||
|
// @Failure 500 {object} appresult.AppError
|
||||||
|
// @Router /loan-orders/{id} [delete]
|
||||||
|
func (h *handler) delete(c *gin.Context) {
|
||||||
|
id, ok := parseID(c.Param("id"))
|
||||||
|
if !ok {
|
||||||
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := h.repository.Delete(c.Request.Context(), id); errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
c.JSON(http.StatusNotFound, appresult.ErrNotFound)
|
||||||
|
return
|
||||||
|
} else if err != nil {
|
||||||
|
h.logger.Errorf("delete loan order failed: %v", err)
|
||||||
|
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, appresult.SuccessWithData("loan order removed"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseID(raw string) (int64, bool) {
|
||||||
|
id, err := strconv.ParseInt(raw, 10, 64)
|
||||||
|
if err != nil || id <= 0 {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
return id, true
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultPage = 1
|
||||||
|
defaultLimit = 10
|
||||||
|
maxLimit = 100
|
||||||
|
)
|
||||||
|
|
||||||
|
func parseListFilter(c *gin.Context) (ListFilter, bool) {
|
||||||
|
filter := ListFilter{
|
||||||
|
Page: defaultPage,
|
||||||
|
Limit: defaultLimit,
|
||||||
|
}
|
||||||
|
|
||||||
|
if raw := c.Query("branch_id"); raw != "" {
|
||||||
|
id, ok := parseID(raw)
|
||||||
|
if !ok {
|
||||||
|
return ListFilter{}, false
|
||||||
|
}
|
||||||
|
filter.BranchId = &id
|
||||||
|
}
|
||||||
|
|
||||||
|
if raw := c.Query("user_id"); raw != "" {
|
||||||
|
id, ok := parseID(raw)
|
||||||
|
if !ok {
|
||||||
|
return ListFilter{}, false
|
||||||
|
}
|
||||||
|
filter.UserId = &id
|
||||||
|
}
|
||||||
|
|
||||||
|
if raw := c.Query("page"); raw != "" {
|
||||||
|
page, err := strconv.Atoi(raw)
|
||||||
|
if err != nil || page < 1 {
|
||||||
|
return ListFilter{}, false
|
||||||
|
}
|
||||||
|
filter.Page = page
|
||||||
|
}
|
||||||
|
|
||||||
|
if raw := c.Query("limit"); raw != "" {
|
||||||
|
limit, err := strconv.Atoi(raw)
|
||||||
|
if err != nil || limit < 1 || limit > maxLimit {
|
||||||
|
return ListFilter{}, false
|
||||||
|
}
|
||||||
|
filter.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
if raw := strings.TrimSpace(c.Query("status")); raw != "" {
|
||||||
|
filter.Status = &raw
|
||||||
|
}
|
||||||
|
|
||||||
|
if raw := strings.TrimSpace(c.Query("region")); raw != "" {
|
||||||
|
filter.Region = raw
|
||||||
|
}
|
||||||
|
|
||||||
|
return filter, true
|
||||||
|
}
|
||||||
11
internal/admin/loanorders/storage.go
Normal file
11
internal/admin/loanorders/storage.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package loanorders
|
||||||
|
|
||||||
|
import "context"
|
||||||
|
|
||||||
|
type Repository interface {
|
||||||
|
List(ctx context.Context, filter ListFilter) (ListLoanOrderDTO, error)
|
||||||
|
GetByID(ctx context.Context, id int64) (LoanOrderDTO, error)
|
||||||
|
Create(ctx context.Context, dto CreateLoanOrderDTO) (LoanOrderDTO, error)
|
||||||
|
Update(ctx context.Context, id int64, dto UpdateLoanOrderDTO) (LoanOrderDTO, error)
|
||||||
|
Delete(ctx context.Context, id int64) error
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ import (
|
|||||||
authdb "online-back/internal/admin/auth/db"
|
authdb "online-back/internal/admin/auth/db"
|
||||||
"online-back/internal/admin/branches"
|
"online-back/internal/admin/branches"
|
||||||
branchesdb "online-back/internal/admin/branches/db"
|
branchesdb "online-back/internal/admin/branches/db"
|
||||||
|
"online-back/internal/admin/loanorders"
|
||||||
|
loanordersdb "online-back/internal/admin/loanorders/db"
|
||||||
"online-back/internal/admin/loansdocument"
|
"online-back/internal/admin/loansdocument"
|
||||||
loansdocumentdb "online-back/internal/admin/loansdocument/db"
|
loansdocumentdb "online-back/internal/admin/loansdocument/db"
|
||||||
"online-back/internal/admin/loantype"
|
"online-back/internal/admin/loantype"
|
||||||
@@ -76,6 +78,7 @@ func adminHandlers(client *pgxpool.Pool, logger *logging.Logger) []handlers.Hand
|
|||||||
reasonscard.NewHandler(logger, reasonscarddb.NewRepository(client, logger)),
|
reasonscard.NewHandler(logger, reasonscarddb.NewRepository(client, logger)),
|
||||||
loantype.NewHandler(logger, loantypedb.NewRepository(client, logger)),
|
loantype.NewHandler(logger, loantypedb.NewRepository(client, logger)),
|
||||||
loansdocument.NewHandler(logger, loansdocumentdb.NewRepository(client, logger)),
|
loansdocument.NewHandler(logger, loansdocumentdb.NewRepository(client, logger)),
|
||||||
|
loanorders.NewHandler(logger, loanordersdb.NewRepository(client, logger)),
|
||||||
role.NewHandler(logger, roledb.NewRepository(client, logger)),
|
role.NewHandler(logger, roledb.NewRepository(client, logger)),
|
||||||
permission.NewHandler(logger, permissiondb.NewRepository(client, logger)),
|
permission.NewHandler(logger, permissiondb.NewRepository(client, logger)),
|
||||||
user.NewHandler(logger, userdb.NewRepository(client, logger)),
|
user.NewHandler(logger, userdb.NewRepository(client, logger)),
|
||||||
|
|||||||
Reference in New Issue
Block a user