minor fix
This commit is contained in:
parent
aaf14fedcf
commit
556860e932
|
|
@ -1,58 +1,218 @@
|
||||||
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||||
|
|
||||||
-- Users
|
-- Users
|
||||||
INSERT INTO users (
|
INSERT INTO users (
|
||||||
id, first_name, last_name, email, phone_number, password, role,
|
id,
|
||||||
email_verified, phone_verified, created_at, updated_at, suspended, company_id
|
first_name,
|
||||||
) VALUES
|
last_name,
|
||||||
(1, 'John', 'Doe', 'john.doe@example.com', NULL,
|
email,
|
||||||
crypt('password123', gen_salt('bf'))::bytea, 'customer',
|
phone_number,
|
||||||
TRUE, FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, FALSE, NULL),
|
password,
|
||||||
|
role,
|
||||||
(2, 'Test', 'Admin', 'test.admin@gmail.com', '0988554466',
|
email_verified,
|
||||||
crypt('password123', gen_salt('bf'))::bytea, 'admin',
|
phone_verified,
|
||||||
TRUE, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, FALSE, 1),
|
created_at,
|
||||||
|
updated_at,
|
||||||
(3, 'Samuel', 'Tariku', 'cybersamt@gmail.com', '0911111111',
|
suspended,
|
||||||
crypt('password@123', gen_salt('bf'))::bytea, 'super_admin',
|
company_id
|
||||||
TRUE, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, FALSE, NULL),
|
)
|
||||||
|
VALUES (
|
||||||
(4, 'Kirubel', 'Kibru', 'kirubel.jkl679@gmail.com', '0911554486',
|
1,
|
||||||
crypt('password@123', gen_salt('bf'))::bytea, 'super_admin',
|
'John',
|
||||||
TRUE, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, FALSE, NULL);
|
'Doe',
|
||||||
|
'john.doe@example.com',
|
||||||
|
NULL,
|
||||||
|
crypt('password123', gen_salt('bf'))::bytea,
|
||||||
|
'customer',
|
||||||
|
TRUE,
|
||||||
|
FALSE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
FALSE,
|
||||||
|
NULL
|
||||||
|
),
|
||||||
|
(
|
||||||
|
2,
|
||||||
|
'Test',
|
||||||
|
'Admin',
|
||||||
|
'test.admin@gmail.com',
|
||||||
|
'0988554466',
|
||||||
|
crypt('password123', gen_salt('bf'))::bytea,
|
||||||
|
'admin',
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
FALSE,
|
||||||
|
1
|
||||||
|
),
|
||||||
|
(
|
||||||
|
3,
|
||||||
|
'Samuel',
|
||||||
|
'Tariku',
|
||||||
|
'cybersamt@gmail.com',
|
||||||
|
'0911111111',
|
||||||
|
crypt('password@123', gen_salt('bf'))::bytea,
|
||||||
|
'super_admin',
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
FALSE,
|
||||||
|
NULL
|
||||||
|
),
|
||||||
|
(
|
||||||
|
4,
|
||||||
|
'Kirubel',
|
||||||
|
'Kibru',
|
||||||
|
'kirubel.jkl679@gmail.com',
|
||||||
|
'0911554486',
|
||||||
|
crypt('password@123', gen_salt('bf'))::bytea,
|
||||||
|
'super_admin',
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
FALSE,
|
||||||
|
NULL
|
||||||
|
),
|
||||||
|
(
|
||||||
|
5,
|
||||||
|
'Test',
|
||||||
|
'Veli',
|
||||||
|
'test.veli@example.com',
|
||||||
|
NULL,
|
||||||
|
crypt('password@123', gen_salt('bf'))::bytea,
|
||||||
|
'customer',
|
||||||
|
TRUE,
|
||||||
|
FALSE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
FALSE,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
-- Supported Operations
|
-- Supported Operations
|
||||||
INSERT INTO supported_operations (id, name, description) VALUES
|
INSERT INTO supported_operations (id, name, description)
|
||||||
(1, 'SportBook', 'Sportbook operations'),
|
VALUES (1, 'SportBook', 'Sportbook operations'),
|
||||||
(2, 'Virtual', 'Virtual operations');
|
(2, 'Virtual', 'Virtual operations');
|
||||||
|
|
||||||
-- Wallets
|
-- Wallets
|
||||||
INSERT INTO wallets (
|
INSERT INTO wallets (
|
||||||
id, balance, is_withdraw, is_bettable, is_transferable, user_id,
|
id,
|
||||||
type, currency, is_active, created_at, updated_at
|
balance,
|
||||||
) VALUES
|
is_withdraw,
|
||||||
(1, 10000, TRUE, TRUE, TRUE, 1, 'regular', 'ETB', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
is_bettable,
|
||||||
(2, 5000, FALSE, TRUE, TRUE, 1, 'static', 'ETB', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
is_transferable,
|
||||||
(3, 20000, TRUE, TRUE, TRUE, 2, 'company_main', 'ETB', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
user_id,
|
||||||
(4, 15000, TRUE, TRUE, TRUE, 2, 'branch_main', 'ETB', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
type,
|
||||||
|
currency,
|
||||||
|
is_active,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
1,
|
||||||
|
10000,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
1,
|
||||||
|
'regular',
|
||||||
|
'ETB',
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
),
|
||||||
|
(
|
||||||
|
2,
|
||||||
|
5000,
|
||||||
|
FALSE,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
1,
|
||||||
|
'static',
|
||||||
|
'ETB',
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
),
|
||||||
|
(
|
||||||
|
3,
|
||||||
|
20000,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
2,
|
||||||
|
'company_main',
|
||||||
|
'ETB',
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
),
|
||||||
|
(
|
||||||
|
4,
|
||||||
|
15000,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
2,
|
||||||
|
'branch_main',
|
||||||
|
'ETB',
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
-- Customer Wallets
|
-- Customer Wallets
|
||||||
INSERT INTO customer_wallets (id, customer_id, regular_wallet_id, static_wallet_id)
|
INSERT INTO customer_wallets (
|
||||||
|
id,
|
||||||
|
customer_id,
|
||||||
|
regular_wallet_id,
|
||||||
|
static_wallet_id
|
||||||
|
)
|
||||||
VALUES (1, 1, 1, 2);
|
VALUES (1, 1, 1, 2);
|
||||||
|
|
||||||
-- Company
|
-- Company
|
||||||
INSERT INTO companies (
|
INSERT INTO companies (
|
||||||
id, name, admin_id, wallet_id, deducted_percentage, is_active, created_at, updated_at
|
id,
|
||||||
) VALUES
|
name,
|
||||||
(1, 'Test Company', 2, 3, 0.10, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
admin_id,
|
||||||
|
wallet_id,
|
||||||
|
deducted_percentage,
|
||||||
|
is_active,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
1,
|
||||||
|
'Test Company',
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
0.10,
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
-- Branch
|
-- Branch
|
||||||
INSERT INTO branches (
|
INSERT INTO branches (
|
||||||
id, name, location, wallet_id, branch_manager_id, company_id,
|
id,
|
||||||
is_self_owned, profit_percent, is_active, created_at, updated_at
|
name,
|
||||||
) VALUES
|
location,
|
||||||
(1, 'Test Branch', 'addis_ababa', 4, 2, 1, TRUE, 0.10, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
wallet_id,
|
||||||
|
branch_manager_id,
|
||||||
|
company_id,
|
||||||
|
is_self_owned,
|
||||||
|
profit_percent,
|
||||||
|
is_active,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
1,
|
||||||
|
'Test Branch',
|
||||||
|
'addis_ababa',
|
||||||
|
4,
|
||||||
|
2,
|
||||||
|
1,
|
||||||
|
TRUE,
|
||||||
|
0.10,
|
||||||
|
TRUE,
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
@ -376,6 +376,7 @@ func (s *Service) PlaceBet(ctx context.Context, req domain.CreateBetReq, userID
|
||||||
)
|
)
|
||||||
return domain.CreateBetRes{}, err
|
return domain.CreateBetRes{}, err
|
||||||
}
|
}
|
||||||
|
//
|
||||||
default:
|
default:
|
||||||
s.mongoLogger.Error("unknown role type",
|
s.mongoLogger.Error("unknown role type",
|
||||||
zap.String("role", string(role)),
|
zap.String("role", string(role)),
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,7 @@ func (a *App) initAppRoutes() {
|
||||||
groupV1.Post("/direct_deposit", a.authMiddleware, h.InitiateDirectDeposit)
|
groupV1.Post("/direct_deposit", a.authMiddleware, h.InitiateDirectDeposit)
|
||||||
groupV1.Post("/direct_deposit/verify", a.authMiddleware, h.VerifyDirectDeposit)
|
groupV1.Post("/direct_deposit/verify", a.authMiddleware, h.VerifyDirectDeposit)
|
||||||
groupV1.Get("/direct_deposit/pending", a.authMiddleware, h.GetPendingDirectDeposits)
|
groupV1.Get("/direct_deposit/pending", a.authMiddleware, h.GetPendingDirectDeposits)
|
||||||
groupV1.Post("/auth/admin-login", h.LoginAdmin)
|
|
||||||
groupV1.Post("/auth/refresh", h.RefreshToken)
|
|
||||||
|
|
||||||
// Swagger
|
// Swagger
|
||||||
a.fiber.Get("/swagger/*", fiberSwagger.FiberWrapHandler())
|
a.fiber.Get("/swagger/*", fiberSwagger.FiberWrapHandler())
|
||||||
|
|
@ -142,6 +141,9 @@ func (a *App) initAppRoutes() {
|
||||||
// groupV1.Post("/arifpay/transaction-id/verify-transaction", a.authMiddleware, h.ArifpayVerifyByTransactionIDHandler)
|
// groupV1.Post("/arifpay/transaction-id/verify-transaction", a.authMiddleware, h.ArifpayVerifyByTransactionIDHandler)
|
||||||
// groupV1.Get("/arifpay/session-id/verify-transaction/:session_id", a.authMiddleware, h.ArifpayVerifyBySessionIDHandler)
|
// groupV1.Get("/arifpay/session-id/verify-transaction/:session_id", a.authMiddleware, h.ArifpayVerifyBySessionIDHandler)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// User Routes
|
// User Routes
|
||||||
tenant.Post("/user/resetPassword", h.ResetPassword)
|
tenant.Post("/user/resetPassword", h.ResetPassword)
|
||||||
tenant.Post("/user/sendResetCode", h.SendResetCode)
|
tenant.Post("/user/sendResetCode", h.SendResetCode)
|
||||||
|
|
@ -155,7 +157,6 @@ func (a *App) initAppRoutes() {
|
||||||
groupV1.Get("/user/single/:id", a.authMiddleware, h.GetUserByID)
|
groupV1.Get("/user/single/:id", a.authMiddleware, h.GetUserByID)
|
||||||
groupV1.Post("/user/suspend", a.authMiddleware, h.UpdateUserSuspend)
|
groupV1.Post("/user/suspend", a.authMiddleware, h.UpdateUserSuspend)
|
||||||
groupV1.Delete("/user/delete/:id", a.authMiddleware, h.DeleteUser)
|
groupV1.Delete("/user/delete/:id", a.authMiddleware, h.DeleteUser)
|
||||||
|
|
||||||
tenantAuth.Get("/user/wallet", a.authMiddleware, h.GetCustomerWallet)
|
tenantAuth.Get("/user/wallet", a.authMiddleware, h.GetCustomerWallet)
|
||||||
tenantAuth.Post("/user/search", a.authMiddleware, h.SearchUserByNameOrPhone)
|
tenantAuth.Post("/user/search", a.authMiddleware, h.SearchUserByNameOrPhone)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user