Compare commits
No commits in common. "feature/BETERAN-SERVER-SERVICE-init" and "main" have entirely different histories.
feature/BE
...
main
|
@ -1,11 +0,0 @@
|
|||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/debian/.devcontainer/base.Dockerfile
|
||||
|
||||
# [Choice] Debian version (use bullseye on local arm64/Apple Silicon): bullseye, buster
|
||||
ARG VARIANT="buster"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
|
||||
|
||||
# ** [Optional] Uncomment this section to install additional packages. **
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install --no-install-recommends libpq-dev
|
|
@ -1,66 +0,0 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/ubuntu
|
||||
{
|
||||
"name": "beteran-server-service",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
// Use the VARIANT arg to pick a Debian OS version: buster, bullseye
|
||||
// Use bullseye when on local on arm64/Apple Silicon.
|
||||
"VARIANT": "bullseye"
|
||||
}
|
||||
},
|
||||
"runArgs": [
|
||||
"--cap-add=SYS_PTRACE",
|
||||
"--security-opt",
|
||||
"seccomp=unconfined"
|
||||
],
|
||||
// Use this environment variable if you need to bind mount your local source code into a new container.
|
||||
"remoteEnv": {
|
||||
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
|
||||
},
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"lldb.verboseLogging": true,
|
||||
"lldb.executable": "/usr/bin/lldb",
|
||||
// VS Code don't watch files under ./target
|
||||
"files.watcherExclude": {
|
||||
"**/.git/objects/**": true,
|
||||
"**/.git/subtree-cache/**": true,
|
||||
"**/target/**": true
|
||||
},
|
||||
"rust-analyzer.checkOnSave.command": "clippy",
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"donjayamanne.githistory",
|
||||
"eamodio.gitlens",
|
||||
"mhutchie.git-graph",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"mutantdino.resourcemonitor",
|
||||
"rust-lang.rust-analyzer",
|
||||
"serayuzgur.crates",
|
||||
"tamasfe.even-better-toml",
|
||||
"vadimcn.vscode-lldb"
|
||||
]
|
||||
}
|
||||
},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "uname -a",
|
||||
"postCreateCommand": "bash ./.devcontainer/scripts/postCreateCommand.sh",
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode",
|
||||
"features": {
|
||||
"git": "latest",
|
||||
"rust": "latest"
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
[toolchain]
|
||||
channel = "stable"
|
||||
profile = "minimal"
|
||||
components = ["clippy", "rustfmt"]
|
||||
targets = []
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,7 +0,0 @@
|
|||
.DS_Store
|
||||
/build
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
Cargo.lock
|
|
@ -1,75 +0,0 @@
|
|||
# https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=
|
||||
array_width = 60
|
||||
attr_fn_like_width = 70
|
||||
binop_separator = "Front" # "Front", "Back"
|
||||
blank_lines_lower_bound = 0
|
||||
blank_lines_upper_bound = 1
|
||||
brace_style = "SameLineWhere" #"AlwaysNextLine", "PreferSameLine", "SameLineWhere"
|
||||
chain_width = 60
|
||||
color = "Auto" #"Auto", "Always", "Never"
|
||||
combine_control_expr = true # true, false
|
||||
comment_width = 80
|
||||
condense_wildcard_suffixes = false # true, false
|
||||
control_brace_style = "AlwaysSameLine" # "AlwaysNextLine", "AlwaysSameLine", "ClosingNextLine"
|
||||
disable_all_formatting = false # true, false
|
||||
edition = "2015" # "2015", "2018", "2021"
|
||||
empty_item_single_line = true # true, false
|
||||
enum_discrim_align_threshold = 0
|
||||
error_on_line_overflow = false # true, false
|
||||
error_on_unformatted = false # true, false
|
||||
fn_args_layout = "Tall" # "Compressed", "Tall", "Vertical"
|
||||
fn_call_width = 60
|
||||
fn_single_line = false # true, false
|
||||
force_explicit_abi = true # true, false
|
||||
force_multiline_blocks = false # true, false
|
||||
format_code_in_doc_comments = false # true, false
|
||||
format_generated_files = false # true, false
|
||||
format_macro_matchers = false # true, false
|
||||
format_macro_bodies = true # true, false
|
||||
format_strings = false # true, false
|
||||
group_imports = "Preserve" # "Preserve", "StdExternalCrate"
|
||||
hard_tabs = false # true, false
|
||||
hex_literal_case = "Preserve" # "Upper", "Lower"
|
||||
hide_parse_errors = false # true, false
|
||||
ignore = []
|
||||
imports_indent = "Block" # "Block", "Visual"
|
||||
imports_layout = "Mixed" # "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
|
||||
indent_style = "Block" # "Block", "Visual"
|
||||
inline_attribute_width = 0
|
||||
license_template_path = ""
|
||||
match_arm_blocks = true # true, false
|
||||
match_arm_leading_pipes = "Never" # "Always", "Never", "Preserve"
|
||||
match_block_trailing_comma = false # true, false
|
||||
max_width = 100
|
||||
merge_derives = true # true, false
|
||||
imports_granularity = "Preserve" # "Preserve", "Crate", "Module", "Item", "One"
|
||||
merge_imports = false # true, false
|
||||
newline_style = "Auto" # "Auto", "Native", "Unix", "Windows"
|
||||
normalize_comments = false # true, false
|
||||
normalize_doc_attributes = false # true, false
|
||||
overflow_delimited_expr = false # true, false
|
||||
remove_nested_parens = true # true, false
|
||||
reorder_impl_items = false # true, false
|
||||
reorder_imports = true # true, false
|
||||
reorder_modules = true # true, false
|
||||
report_fixme = "Never" # "Always", "Unnumbered", "Never"
|
||||
report_todo = "Never" # "Always", "Unnumbered", "Never"
|
||||
skip_children = false # true, false
|
||||
single_line_if_else_max_width = 50
|
||||
space_after_colon = true # true, false
|
||||
space_before_colon = false # true, false
|
||||
spaces_around_ranges = false # true, false
|
||||
struct_field_align_threshold = 0
|
||||
struct_lit_single_line = true # true, false
|
||||
struct_lit_width = 18
|
||||
struct_variant_width = 35
|
||||
tab_spaces = 2
|
||||
trailing_comma = "Vertical" # "Always", "Never", "Vertical"
|
||||
trailing_semicolon = true # true, false
|
||||
type_punctuation_density = "Wide" # "Compressed", "Wide"
|
||||
unstable_features = false # true, false
|
||||
use_field_init_shorthand = false # true, false
|
||||
use_small_heuristics = "Default" # "Default", "Off", "Max"
|
||||
use_try_shorthand = false # true, false
|
||||
where_single_line = false # true, false
|
||||
wrap_comments = false # true, false
|
59
.vscode/launch.json
vendored
59
.vscode/launch.json
vendored
|
@ -1,59 +0,0 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug executable 'beteran-server-service'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"build",
|
||||
"--bin=beteran-server-service",
|
||||
"--package=beteran-server-service"
|
||||
],
|
||||
"filter": {
|
||||
"name": "beteran-server-service",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"URL_DATABASE": "postgresql://beteran:qwer5795QWER@192.168.50.205:25432/beteran",
|
||||
"URL_BROKER": "nats://192.168.50.205:4222",
|
||||
"QUEUE_BROKER": "bet.beteran",
|
||||
"CAPTCHA_SALT": "!#%&(24680qetuWRYI",
|
||||
"PASSWORD_SALT": "@$^*)13579wryipQETUO",
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug unit tests in executable 'beteran-server-service'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"test",
|
||||
"--no-run",
|
||||
"--bin=beteran-server-service",
|
||||
"--package=beteran-server-service"
|
||||
],
|
||||
"filter": {
|
||||
"name": "beteran-server-service",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"URL_DATABASE": "postgresql://beteran:qwer5795QWER@192.168.50.205:25432/beteran",
|
||||
"URL_BROKER": "nats://192.168.50.205:4222",
|
||||
"QUEUE_BROKER": "bet.beteran",
|
||||
"CAPTCHA_SALT": "!#%&(24680qetuWRYI",
|
||||
"PASSWORD_SALT": "@$^*)13579wryipQETUO",
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
42
Cargo.toml
42
Cargo.toml
|
@ -1,42 +0,0 @@
|
|||
[package]
|
||||
name = "beteran-server-service"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[[bin]]
|
||||
name = "beteran-server-service"
|
||||
path = "./src/main.rs"
|
||||
|
||||
|
||||
[dependencies]
|
||||
anyhow = { version = "=1.0.59" }
|
||||
captcha = { version = "0" }
|
||||
chrono = { version = "0" }
|
||||
diesel = { version = "1", default-features = false, features = [
|
||||
"chrono",
|
||||
"r2d2",
|
||||
"uuidv07",
|
||||
"postgres",
|
||||
"serde_json",
|
||||
"64-column-tables",
|
||||
] }
|
||||
diesel_migrations = { version = "1" }
|
||||
diesel-derive-enum = { version = "1", features = ["postgres"] }
|
||||
futures = { version = "0", default-features = false, features = [
|
||||
"async-await",
|
||||
] }
|
||||
nats = { version = "0" }
|
||||
prost = { version = "0" }
|
||||
rust-argon2 = { version = "1" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = { version = "1" }
|
||||
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
||||
tokio-cron-scheduler = { version = "0" }
|
||||
uuid = { version = "0", features = ["serde", "v4", "v5"] }
|
||||
|
||||
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.99-snapshot" }
|
||||
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.85-snapshot" }
|
||||
|
||||
[build-dependencies]
|
|
@ -1,4 +0,0 @@
|
|||
DROP EXTENSION "uuid-ossp";
|
||||
DROP FUNCTION update_updated_at_column;
|
||||
DROP FUNCTION update_state_changed_at_column;
|
||||
DROP FUNCTION update_active_changed_at_column;
|
|
@ -1,35 +0,0 @@
|
|||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = (extract(epoch from now()) * 1000);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ language 'plpgsql';
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_state_changed_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF OLD.state != NEW.state THEN
|
||||
NEW.state_changed_at = (extract(epoch from now()) * 1000);
|
||||
ELSE
|
||||
NEW.state_changed_at = NEW.state_changed_at;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ language 'plpgsql';
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_active_changed_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF OLD.active != NEW.active THEN
|
||||
NEW.active_changed_at = (extract(epoch from now()) * 1000);
|
||||
ELSE
|
||||
NEW.active_changed_at = NEW.active_changed_at;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ language 'plpgsql';
|
|
@ -1,4 +0,0 @@
|
|||
DROP UNIQUE INDEX uidx_sites_url;
|
||||
DROP TRIGGER tg_sites_updated_at;
|
||||
DROP TABLE sites;
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS sites (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
url TEXT NOT NULL,
|
||||
name TEXT,
|
||||
path TEXT,
|
||||
show BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
memo TEXT,
|
||||
expires_at BIGINT,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (url)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uidx_sites_url ON sites (url);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_sites_updated_at
|
||||
BEFORE UPDATE
|
||||
ON sites
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,4 +0,0 @@
|
|||
DROP INDEX idx_resources_parent_id;
|
||||
CREATE UNIQUE INDEX uidx_resources_key;
|
||||
DROP TRIGGER tg_resources_updated_at;
|
||||
DROP TABLE resources;
|
|
@ -1,24 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS resources (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
parent_id UUID,
|
||||
name TEXT NOT NULL,
|
||||
key TEXT NOT NULL,
|
||||
description TEXT,
|
||||
can_use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_resources_parent_id
|
||||
FOREIGN KEY(parent_id)
|
||||
REFERENCES resources(id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uidx_resources_key ON resources (key);
|
||||
CREATE INDEX idx_resources_parent_id ON resources (parent_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_resources_updated_at
|
||||
BEFORE UPDATE
|
||||
ON resources
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,4 +0,0 @@
|
|||
DROP UNIQUE INDEX uidx_resource_actions_key;
|
||||
DROP INDEX idx_resource_actions_resource_id;
|
||||
DROP TRIGGER tg_resource_actions_updated_at;
|
||||
DROP TABLE resource_actions;
|
|
@ -1,25 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS resource_actions (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
resource_id UUID NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
key TEXT NOT NULL,
|
||||
description TEXT,
|
||||
can_use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_resource_actions_resource_id
|
||||
FOREIGN KEY(resource_id)
|
||||
REFERENCES resources(id)
|
||||
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uidx_resource_actions_key ON resource_actions (key);
|
||||
CREATE INDEX idx_resource_actions_resource_id ON resource_actions (resource_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_resource_actions_updated_at
|
||||
BEFORE UPDATE
|
||||
ON resource_actions
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,4 +0,0 @@
|
|||
DROP UNIQUE INDEX uidx_roles_key;
|
||||
DROP INDEX idx_roles_parent_id;
|
||||
DROP TRIGGER tg_roles_updated_at;
|
||||
DROP TABLE roles;
|
|
@ -1,26 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS roles (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
parent_id UUID,
|
||||
name TEXT NOT NULL,
|
||||
key TEXT NOT NULL,
|
||||
description TEXT,
|
||||
can_use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (key),
|
||||
CONSTRAINT fk_roles_parent_id
|
||||
FOREIGN KEY(parent_id)
|
||||
REFERENCES roles(id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uidx_roles_key ON roles (key);
|
||||
CREATE INDEX idx_roles_parent_id ON roles (parent_id);
|
||||
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_roles_updated_at
|
||||
BEFORE UPDATE
|
||||
ON roles
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,2 +0,0 @@
|
|||
DROP INDEX idx_role_resource_actions_role_id;
|
||||
DROP TABLE role_resource_actions;
|
|
@ -1,14 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS role_resource_actions (
|
||||
role_id UUID NOT NULL,
|
||||
resource_action_id UUID NOT NULL,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (role_id, resource_action_id),
|
||||
CONSTRAINT fk_role_actions_role_id
|
||||
FOREIGN KEY(role_id)
|
||||
REFERENCES roles(id),
|
||||
CONSTRAINT fk_role_actions_resource_action_id
|
||||
FOREIGN KEY(resource_action_id)
|
||||
REFERENCES resource_actions(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_role_resource_actions_role_id ON role_resource_actions (role_id);
|
|
@ -1,3 +0,0 @@
|
|||
DROP TRIGGER tg_member_levels_updated_at;
|
||||
DROP TABLE member_levels;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_levels (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
name TEXT NOT NULL,
|
||||
show BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
sort_order INTEGER NOT NULL,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_levels_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_levels
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,3 +0,0 @@
|
|||
DROP TRIGGER tg_member_classes_updated_at;
|
||||
DROP TABLE member_classes;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_classes (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
name TEXT NOT NULL,
|
||||
show BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
parent_id UUID,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_classes_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_classes
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,5 +0,0 @@
|
|||
DROP INDEX idx_members_username;
|
||||
DROP TRIGGER tg_members_state_changed_at;
|
||||
DROP TRIGGER tg_members_updated_at;
|
||||
DROP TABLE members;
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
CREATE TYPE member_state AS ENUM ('normal', 'pending', 'withdrawal', 'dormancy', 'blacklist', 'suspended');
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS members (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
site_id UUID NOT NULL,
|
||||
member_class_id UUID NOT NULL,
|
||||
member_level_id UUID NOT NULL,
|
||||
username TEXT NOT NULL,
|
||||
password TEXT NOT NULL,
|
||||
nickname TEXT NOT NULL,
|
||||
mobile_phone_number TEXT,
|
||||
state MEMBER_STATE DEFAULT 'normal',
|
||||
state_changed_at BIGINT,
|
||||
parent_member_id UUID,
|
||||
child_member_count BIGINT NOT NULL DEFAULT 0,
|
||||
last_signined_ip TEXT,
|
||||
last_signined_at BIGINT,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
deleted_at BIGINT,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (username),
|
||||
CONSTRAINT fk_members_site_id
|
||||
FOREIGN KEY(site_id)
|
||||
REFERENCES sites(id),
|
||||
CONSTRAINT fk_members_member_class_id
|
||||
FOREIGN KEY(member_class_id)
|
||||
REFERENCES member_classes(id),
|
||||
CONSTRAINT fk_members_member_level_id
|
||||
FOREIGN KEY(member_level_id)
|
||||
REFERENCES member_levels(id),
|
||||
CONSTRAINT fk_members_parent_member_id
|
||||
FOREIGN KEY(parent_member_id)
|
||||
REFERENCES members(id)
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX idx_members_username ON members (username);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_members_updated_at
|
||||
BEFORE UPDATE
|
||||
ON members
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
||||
|
||||
-- trigger (state_changed_at)
|
||||
CREATE TRIGGER tg_members_state_changed_at
|
||||
BEFORE UPDATE
|
||||
ON members
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_state_changed_at_column();
|
|
@ -1,3 +0,0 @@
|
|||
DROP INDEX idx_member_roles_member_id;
|
||||
DROP INDEX idx_member_roles_role_id;
|
||||
DROP TABLE member_roles;
|
|
@ -1,15 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_roles (
|
||||
member_id UUID NOT NULL,
|
||||
role_id UUID NOT NULL,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (member_id, role_id),
|
||||
CONSTRAINT fk_member_roles_role_id
|
||||
FOREIGN KEY(role_id)
|
||||
REFERENCES roles(id),
|
||||
CONSTRAINT fk_member_roles_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_roles_role_id ON member_roles (role_id);
|
||||
CREATE INDEX idx_member_roles_member_id ON member_roles (member_id);
|
|
@ -1,3 +0,0 @@
|
|||
DROP INDEX idx_member_permissions_resource_action_id;
|
||||
DROP INDEX idx_member_permissions_member_id;
|
||||
DROP TABLE member_permissions;
|
|
@ -1,15 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_permissions (
|
||||
member_id UUID NOT NULL,
|
||||
resource_action_id UUID NOT NULL,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (member_id, resource_action_id),
|
||||
CONSTRAINT fk_member_permissions_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id),
|
||||
CONSTRAINT fk_member_permissions_resource_action_id
|
||||
FOREIGN KEY(resource_action_id)
|
||||
REFERENCES resource_actions(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_permissions_resource_action_id ON member_permissions (resource_action_id);
|
||||
CREATE INDEX idx_member_permissions_member_id ON member_permissions (member_id);
|
|
@ -1,3 +0,0 @@
|
|||
DROP INDEX idx_member_referrers_member_id;
|
||||
DROP TRIGGER tg_member_referrers_updated_at;
|
||||
DROP TABLE member_referrers;
|
|
@ -1,22 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_referrers (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
can_use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
memo TEXT,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_member_referrers_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_referrers_member_id ON member_referrers (member_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_referrers_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_referrers
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
||||
|
|
@ -1 +0,0 @@
|
|||
DROP TABLE member_sessions;
|
|
@ -1,14 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_sessions (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
ip TEXT,
|
||||
last_accessed_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
expires_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
|
||||
PRIMARY KEY (id),
|
||||
|
||||
CONSTRAINT fk_member_sessions_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
);
|
|
@ -1,4 +0,0 @@
|
|||
DROP UNIQUE INDEX uidx_banks_url;
|
||||
DROP TRIGGER tg_banks_updated_at;
|
||||
DROP TABLE banks;
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS banks (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
name TEXT NOT NULL,
|
||||
sort_order INTEGER NOT NULL,
|
||||
show BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
memo TEXT,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uidx_banks_name ON banks (name);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_banks_updated_at
|
||||
BEFORE UPDATE
|
||||
ON banks
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,3 +0,0 @@
|
|||
DROP INDEX idx_member_bank_accounts_member_id;
|
||||
DROP TRIGGER tg_member_bank_accounts_updated_at;
|
||||
DROP TABLE member_bank_accounts;
|
|
@ -1,28 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_bank_accounts (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
bank_id UUID NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
account_number TEXT NOT NULL,
|
||||
exchange_password TEXT NOT NULL,
|
||||
memo TEXT,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_member_bank_accounts_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id),
|
||||
CONSTRAINT fk_member_bank_accounts_bank_id
|
||||
FOREIGN KEY(bank_id)
|
||||
REFERENCES banks(id)
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_bank_accounts_member_id ON member_bank_accounts (member_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_bank_accounts_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_bank_accounts
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,4 +0,0 @@
|
|||
DROP INDEX idx_member_bank_deposits_member_id;
|
||||
DROP TRIGGER tg_member_bank_deposits_updated_at;
|
||||
DROP TRIGGER tg_member_bank_deposits_state_changed_at;
|
||||
DROP TABLE member_bank_deposits;
|
|
@ -1,35 +0,0 @@
|
|||
CREATE TYPE member_bank_deposit_state AS ENUM ('application', 'pending', 'complete');
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS member_bank_deposits (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
amount DOUBLE PRECISION NOT NULL,
|
||||
memo TEXT,
|
||||
state MEMBER_BANK_DEPOSIT_STATE DEFAULT 'application',
|
||||
state_changed_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_member_bank_deposits_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_bank_deposits_member_id ON member_bank_deposits (member_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_bank_deposits_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_bank_deposits
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
||||
|
||||
-- trigger (state_changed_at)
|
||||
CREATE TRIGGER tg_member_bank_deposits_state_changed_at
|
||||
BEFORE UPDATE
|
||||
ON member_bank_deposits
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_state_changed_at_column();
|
|
@ -1,4 +0,0 @@
|
|||
DROP INDEX idx_member_bank_withdraws_member_id;
|
||||
DROP TRIGGER tg_member_bank_withdraws_updated_at;
|
||||
DROP TRIGGER tg_member_bank_withdraws_state_changed_at;
|
||||
DROP TABLE member_bank_withdraws;
|
|
@ -1,38 +0,0 @@
|
|||
CREATE TYPE member_bank_withdraw_state AS ENUM ('application', 'pending', 'complete');
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS member_bank_withdraws (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
bank_name TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
account_number TEXT NOT NULL,
|
||||
amount DOUBLE PRECISION NOT NULL,
|
||||
password TEXT NOT NULL,
|
||||
memo TEXT,
|
||||
state MEMBER_BANK_WITHDRAW_STATE DEFAULT 'application',
|
||||
state_changed_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_member_bank_withdraws_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_bank_withdraws_member_id ON member_bank_withdraws (member_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_bank_withdraws_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_bank_withdraws
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
||||
|
||||
-- trigger (state_changed_at)
|
||||
CREATE TRIGGER tg_member_bank_withdraws_state_changed_at
|
||||
BEFORE UPDATE
|
||||
ON member_bank_withdraws
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_state_changed_at_column();
|
|
@ -1,3 +0,0 @@
|
|||
DROP INDEX idx_member_game_settings_member_id;
|
||||
DROP TRIGGER tg_member_game_settings_updated_at;
|
||||
DROP TABLE member_game_settings;
|
|
@ -1,25 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_game_settings (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
can_bet_casino BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_bet_slot BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_bet_powerball BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_bet_powerladder BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_bet_eos BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_bet_bogglepowerball BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_member_game_settings_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_game_settings_member_id ON member_game_settings (member_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_game_settings_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_game_settings
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,3 +0,0 @@
|
|||
DROP INDEX idx_member_settlement_settings_member_id;
|
||||
DROP TRIGGER tg_member_settlement_settings_updated_at;
|
||||
DROP TABLE member_settlement_settings;
|
|
@ -1,42 +0,0 @@
|
|||
CREATE TYPE settlement_type AS ENUM ('rolling', 'loosing');
|
||||
CREATE TYPE manual_payment_type AS ENUM ('all_child_partner', 'only_direct_partner', 'disable');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS member_settlement_settings (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
can_exchange BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_first_charge_comp BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
can_per_charge_comp BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
manual_payment_type_for_partner MANUAL_PAYMENT_TYPE DEFAULT 'all_child_partner',
|
||||
settlement_type SETTLEMENT_TYPE DEFAULT 'rolling',
|
||||
rate_casino DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_casino_loosing DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_casino_bacara DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_casino_roulette DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_casino_dragon_tiger DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_slot DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_slot_loosing DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_powerball_single DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_powerball_combo DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_powerladder_single DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_powerladder_combo DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_eos_single DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_eos_combo DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_bogglepowerball_single DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
rate_bogglepowerball_combo DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_member_settlement_settings_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_settlement_settings_member_id ON member_settlement_settings (member_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_settlement_settings_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_settlement_settings
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1,3 +0,0 @@
|
|||
DROP INDEX idx_member_balances_member_id;
|
||||
DROP TRIGGER tg_member_balances_updated_at;
|
||||
DROP TABLE member_balances;
|
|
@ -1,23 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS member_balances (
|
||||
id UUID DEFAULT uuid_generate_v4(),
|
||||
member_id UUID NOT NULL,
|
||||
balance DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
balance_bota DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
balance_sum DOUBLE PRECISION NOT NULL DEFAULT 0.00,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_member_balances_member_id
|
||||
FOREIGN KEY(member_id)
|
||||
REFERENCES members(id)
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX idx_member_balances_member_id ON member_balances (member_id);
|
||||
|
||||
-- trigger (updated_at)
|
||||
CREATE TRIGGER tg_member_balances_updated_at
|
||||
BEFORE UPDATE
|
||||
ON member_balances
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_updated_at_column();
|
|
@ -1 +0,0 @@
|
|||
DELETE FROM resources WHERE id = '113c424a-45f6-4261-9d97-6438d2b694f8';
|
|
@ -1,950 +0,0 @@
|
|||
-- identity
|
||||
INSERT INTO resources (id, parent_id, name, key) VALUES ('f90ab988-128f-488b-995f-6b1feae23fba', null, 'identity', 'identity');
|
||||
-- member
|
||||
INSERT INTO resources (id, parent_id, name, key) VALUES ('113c424a-45f6-4261-9d97-6438d2b694f8', null, 'member', 'member');
|
||||
|
||||
-- actions of identity
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('e71bbb2b-d3f5-43a3-82a1-b5485a65bbbf', 'f90ab988-128f-488b-995f-6b1feae23fba', 'signup', 'identity.signup');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('68181eee-0b44-4cfa-8cd9-6c95d4369fd5', 'f90ab988-128f-488b-995f-6b1feae23fba', 'withdraw', 'identity.withdraw');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('75588b0c-ee9e-4af1-a183-c43f67b5aa9b', 'f90ab988-128f-488b-995f-6b1feae23fba', 'signin', 'identity.signin');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('37b99823-188b-4b30-afb7-815a7e79662b', 'f90ab988-128f-488b-995f-6b1feae23fba', 'signout', 'identity.signout');
|
||||
-- actions of member
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('9d1afd68-bf25-4e0b-8e85-c064d1d0b33f', '113c424a-45f6-4261-9d97-6438d2b694f8', 'create', 'member.create');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('0966592e-a7ff-434d-86cf-17b5fc6dbde8', '113c424a-45f6-4261-9d97-6438d2b694f8', 'read', 'member.read');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('45d4b3ce-5b1f-487c-a40b-ecb209b58046', '113c424a-45f6-4261-9d97-6438d2b694f8', 'search', 'member.search');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66', '113c424a-45f6-4261-9d97-6438d2b694f8', 'report', 'member.report');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('d8165ce7-4135-41ba-b022-c2e7b1346ea6', '113c424a-45f6-4261-9d97-6438d2b694f8', 'update', 'member.update');
|
||||
INSERT INTO resource_actions (id, resource_id, name, key) VALUES ('83304e75-6760-497e-b25f-3ebd6586af34', '113c424a-45f6-4261-9d97-6438d2b694f8', 'delete', 'member.delete');
|
||||
|
||||
-- role of administrator
|
||||
INSERT INTO roles (id, parent_id, name, key) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', null, 'administrator', 'ROLE_ADMINISTRATOR');
|
||||
-- role of partner
|
||||
INSERT INTO roles (id, parent_id, name, key) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', null, 'partner', 'ROLE_PARTNER');
|
||||
-- role of user
|
||||
INSERT INTO roles (id, parent_id, name, key) VALUES ('b6a2b662-e21e-44e7-a96c-dacd86f9d6b8', null, 'user', 'ROLE_USER');
|
||||
|
||||
-- resource_actions of administrator role
|
||||
-- identity.signin
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- identity.signout
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- member.create
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- member.read
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- member.search
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- member.report
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- member.update
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
-- member.delete
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('96993de5-d628-434d-a6cb-55a84a35db1a', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
|
||||
|
||||
-- resource_actions of partner role
|
||||
-- identity.signin
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- identity.signout
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- member.create
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- member.read
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- member.search
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- member.report
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- member.update
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
-- member.delete
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('ac1c4ea4-1de8-46b6-8239-4fd67a1ba205', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
|
||||
-- resource_actions of user role
|
||||
-- identity.signup
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('b6a2b662-e21e-44e7-a96c-dacd86f9d6b8', 'e71bbb2b-d3f5-43a3-82a1-b5485a65bbbf');
|
||||
-- identity.withdraw
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('b6a2b662-e21e-44e7-a96c-dacd86f9d6b8', '68181eee-0b44-4cfa-8cd9-6c95d4369fd5');
|
||||
-- identity.signin
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('b6a2b662-e21e-44e7-a96c-dacd86f9d6b8', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- identity.signout
|
||||
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('b6a2b662-e21e-44e7-a96c-dacd86f9d6b8', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
|
||||
INSERT INTO sites (id, url, name, path, show) VALUES ('d7cbae26-53b6-4cb1-85a4-66b956cbe1d4', '*', '전체', '/', false);
|
||||
INSERT INTO sites (id, url, name, path, show) VALUES ('8429a7ab-b9de-400b-a209-28ff46e22bec', '127.0.0.1', '개발용', '/', false);
|
||||
|
||||
|
||||
INSERT INTO member_levels (id, name, sort_order, show) VALUES ('c238463f-949d-49eb-92ab-dca7a09371db', 'LEVEL0', 0, false);
|
||||
INSERT INTO member_levels (id, name, sort_order, show) VALUES ('c56231ac-2120-4a81-a30a-5d41fafb6c57', 'LEVEL1', 1, true);
|
||||
INSERT INTO member_levels (id, name, sort_order, show) VALUES ('df49d067-d554-43b1-87f4-82fb246cec5f', 'LEVEL2', 2, true);
|
||||
INSERT INTO member_levels (id, name, sort_order, show) VALUES ('0cce35ee-9668-495e-8840-e3d7b5b01b76', 'LEVEL3', 3, true);
|
||||
INSERT INTO member_levels (id, name, sort_order, show) VALUES ('e7e768d7-1d3d-4ae1-866d-4db1c1f0d9a5', 'LEVEL4', 4, true);
|
||||
|
||||
INSERT INTO member_classes (id, name, parent_id, show) VALUES ('232593d4-0f17-4798-bc92-a09fce9b6a7e', '관리자', null, false);
|
||||
INSERT INTO member_classes (id, name, parent_id, show) VALUES ('4b014ef5-3bab-4413-aaf9-b0040a70ec77', '본사', '232593d4-0f17-4798-bc92-a09fce9b6a7e', true);
|
||||
INSERT INTO member_classes (id, name, parent_id, show) VALUES ('ae9b874e-5d0e-4c4d-8432-f45f02691ceb', '대본', '4b014ef5-3bab-4413-aaf9-b0040a70ec77', true);
|
||||
INSERT INTO member_classes (id, name, parent_id, show) VALUES ('f25a17e9-5c5f-4e9c-bf80-92a9cedf829c', '부본', 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb', true);
|
||||
INSERT INTO member_classes (id, name, parent_id, show) VALUES ('cac7b897-2549-4f04-8415-8868f1dcb1da', '총판', 'f25a17e9-5c5f-4e9c-bf80-92a9cedf829c', true);
|
||||
INSERT INTO member_classes (id, name, parent_id, show) VALUES ('e11cac11-3825-4f4e-9cd5-39367f23f973', '매장', 'cac7b897-2549-4f04-8415-8868f1dcb1da', true);
|
||||
INSERT INTO member_classes (id, name, parent_id, show) VALUES ('4598f07a-86d1-42a4-b038-25706683a7cd', '회원', 'e11cac11-3825-4f4e-9cd5-39367f23f973', true);
|
||||
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('816eff0d-db96-4753-98e3-36035a9a012b', '국민은행', 0);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('20c9c093-fd6a-463d-9de4-e93d0db0e7eb', '광주은행', 1);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('f29d0f2c-3a44-4cb0-a2be-e017a8d6ca1a', '경남은행', 2);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('e87fb908-503b-45d3-9135-395379bfae40', '기업은행', 3);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('76288961-dceb-4f4f-9a11-9c78697142b4', '농협', 4);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('dda3f025-dbb5-46c4-bc4a-99d03e38a32d', '대구은행', 5);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('3a605288-f44f-48fa-9b8c-29d0f0bbb2d3', '도이치은행', 6);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('7bc942da-4f09-4d53-95e8-d3376c14e0ee', '부산은행', 7);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('233123a1-5644-4906-a250-3cde4c53e422', '새마을금고', 8);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('334ad8a2-15a8-4e5b-8d64-a3d237dc213b', '수협', 9);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('54dd2c4c-a8c2-47d8-923c-da83af072d26', '신한은행', 10);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('1d862fcc-287e-42bc-9fde-a510ebd0d922', '외환은행', 11);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('02cb96e6-6ddd-4826-ab07-280a34e4b6bc', '우리은행', 12);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('cb77185b-164d-4faa-8022-b10e1e28d35c', '우체국', 13);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('c73db022-7de6-4635-8f34-6c3923cb7b09', '전북은행', 14);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('05851cfa-96cd-4f8a-b813-5aa6c1929f0a', '제주은행', 15);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('297998cf-3fe8-4d3b-8ebe-156c200ec534', '하나은행', 16);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('e576b713-c798-4956-b89e-e23ce23524b2', '한국씨티은행', 17);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('3096a455-7280-41d8-9525-43a4060dca52', 'HSBC은행', 18);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('7f3cb09a-7746-4937-aec1-a3e7d5ce493c', 'SC제일은행', 19);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('f086a43a-e69a-4725-b4d5-868e9a32206b', '신협', 20);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('76196e64-838d-42ab-9a65-9aea66e15844', '카카오뱅크', 21);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('cb2330ee-3b72-4ff5-819d-f7ebbcd01b03', 'K뱅크', 22);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('3967f424-2457-4a21-9ad0-cbe9a6aaf4b1', '산림조합', 23);
|
||||
INSERT INTO banks (id, name, sort_order) VALUES ('fd245c51-16d3-497b-b9a8-b3dc71acce87', '산업은행', 24);
|
||||
|
||||
INSERT INTO members(
|
||||
id,
|
||||
site_id, member_class_id, member_level_id,
|
||||
username, password, nickname, mobile_phone_number,
|
||||
state
|
||||
) VALUES (
|
||||
'8239f500-ebf7-4900-9fa9-4a9368a409e4',
|
||||
'd7cbae26-53b6-4cb1-85a4-66b956cbe1d4', '232593d4-0f17-4798-bc92-a09fce9b6a7e', 'c238463f-949d-49eb-92ab-dca7a09371db',
|
||||
'administrator', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', 'administrator', '',
|
||||
'normal'
|
||||
);
|
||||
|
||||
INSERT INTO members (id, site_id, member_class_id, member_level_id, username, password, nickname, mobile_phone_number, state, state_changed_at, parent_member_id, child_member_count, last_signined_ip, last_signined_at, created_at, updated_at, deleted_at) VALUES ('c4c8c3c7-3ad7-4a89-a9b2-2df8c9c66002', 'd7cbae26-53b6-4cb1-85a4-66b956cbe1d4', '4b014ef5-3bab-4413-aaf9-b0040a70ec77', 'c56231ac-2120-4a81-a30a-5d41fafb6c57', 'bonsa01', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '본사01', '01012341234', 'normal', NULL, NULL, 0, NULL, NULL, 1662368913534, 1662368913534, NULL);
|
||||
INSERT INTO members (id, site_id, member_class_id, member_level_id, username, password, nickname, mobile_phone_number, state, state_changed_at, parent_member_id, child_member_count, last_signined_ip, last_signined_at, created_at, updated_at, deleted_at) VALUES ('8f335e71-6b3a-4661-935f-ad71ea90a529', 'd7cbae26-53b6-4cb1-85a4-66b956cbe1d4', 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb', 'c56231ac-2120-4a81-a30a-5d41fafb6c57', 'daebon01', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '대본01', '01023453456', 'normal', NULL, 'c4c8c3c7-3ad7-4a89-a9b2-2df8c9c66002', 0, NULL, NULL, 1662368954736, 1662368954736, NULL);
|
||||
INSERT INTO members (id, site_id, member_class_id, member_level_id, username, password, nickname, mobile_phone_number, state, state_changed_at, parent_member_id, child_member_count, last_signined_ip, last_signined_at, created_at, updated_at, deleted_at) VALUES ('b378d495-12c5-42ea-a717-f1fc81eae2d2', 'd7cbae26-53b6-4cb1-85a4-66b956cbe1d4', 'f25a17e9-5c5f-4e9c-bf80-92a9cedf829c', 'c56231ac-2120-4a81-a30a-5d41fafb6c57', 'bubon01', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '부본01', '01021391828', 'normal', NULL, '8f335e71-6b3a-4661-935f-ad71ea90a529', 0, NULL, NULL, 1662368992042, 1662368992042, NULL);
|
||||
INSERT INTO members (id, site_id, member_class_id, member_level_id, username, password, nickname, mobile_phone_number, state, state_changed_at, parent_member_id, child_member_count, last_signined_ip, last_signined_at, created_at, updated_at, deleted_at) VALUES ('ab59d6d8-c5d6-4bb6-a9f7-1658801f78fc', 'd7cbae26-53b6-4cb1-85a4-66b956cbe1d4', 'cac7b897-2549-4f04-8415-8868f1dcb1da', 'c56231ac-2120-4a81-a30a-5d41fafb6c57', 'chongpan01', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '총판01', '01026667733', 'normal', NULL, 'b378d495-12c5-42ea-a717-f1fc81eae2d2', 0, NULL, NULL, 1662369018659, 1662369018659, NULL);
|
||||
INSERT INTO members (id, site_id, member_class_id, member_level_id, username, password, nickname, mobile_phone_number, state, state_changed_at, parent_member_id, child_member_count, last_signined_ip, last_signined_at, created_at, updated_at, deleted_at) VALUES ('df062e89-91f2-42ac-ba84-4f8fd37ea840', 'd7cbae26-53b6-4cb1-85a4-66b956cbe1d4', 'e11cac11-3825-4f4e-9cd5-39367f23f973', 'c56231ac-2120-4a81-a30a-5d41fafb6c57', 'maejang01', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '매장01', '010293829182', 'normal', NULL, 'ab59d6d8-c5d6-4bb6-a9f7-1658801f78fc', 0, NULL, NULL, 1662369066463, 1662369066463, NULL);
|
||||
INSERT INTO members (id, site_id, member_class_id, member_level_id, username, password, nickname, mobile_phone_number, state, state_changed_at, parent_member_id, child_member_count, last_signined_ip, last_signined_at, created_at, updated_at, deleted_at) VALUES ('2cc97c3b-0d82-4965-a68e-6aced1e179ec', 'd7cbae26-53b6-4cb1-85a4-66b956cbe1d4', '4598f07a-86d1-42a4-b038-25706683a7cd', 'c56231ac-2120-4a81-a30a-5d41fafb6c57', 'test01', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$oO8rlAVRUAAXS9Y/rULDehwqnqwpUtlDjcNuaxHCdRU', '테스트01', '01012345678', 'normal', 1662369143488, 'df062e89-91f2-42ac-ba84-4f8fd37ea840', 0, NULL, NULL, 1662369124876, 1662369143488, NULL);
|
||||
|
||||
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'd2e0c759-ea4c-426b-ad2a-f8ff4750c859',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4b014ef5-3bab-4413-aaf9-b0040a70ec77', 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
-- 'bonsa0lvl1', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '본사0레벨1', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'ef20589c-3405-4e77-9fd0-2068248b7673',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4b014ef5-3bab-4413-aaf9-b0040a70ec77', 'df49d067-d554-43b1-87f4-82fb246cec5f',
|
||||
-- 'bonsa0lvl2', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '본사0레벨2', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '608c74a0-7397-48d5-9be9-db95e758f7a1',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4b014ef5-3bab-4413-aaf9-b0040a70ec77', '0cce35ee-9668-495e-8840-e3d7b5b01b76',
|
||||
-- 'bonsa0lvl3', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '본사0레벨3', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '661a656a-56e7-4549-b5ca-05c517ae31f1',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4b014ef5-3bab-4413-aaf9-b0040a70ec77', 'e7e768d7-1d3d-4ae1-866d-4db1c1f0d9a5',
|
||||
-- 'bonsa0lvl4', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '본사0레벨4', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '67910e4b-e31e-41a1-b45c-54b38faea032',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb', 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
-- 'daebon0lvl1', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '대본0레벨1', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '3b6832c3-1e5f-4135-8756-7dd20d38cb5a',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb', 'df49d067-d554-43b1-87f4-82fb246cec5f',
|
||||
-- 'daebon0lvl2', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '대본0레벨2', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb', '0cce35ee-9668-495e-8840-e3d7b5b01b76',
|
||||
-- 'daebon0lvl3', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '대본0레벨3', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '62ba1a59-3a3c-447a-a249-769233f4010d',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb', 'e7e768d7-1d3d-4ae1-866d-4db1c1f0d9a5',
|
||||
-- 'daebon0lvl4', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '대본0레벨4', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'c305d2e1-8242-433e-9f2d-782012e080ae',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'f25a17e9-5c5f-4e9c-bf80-92a9cedf829c', 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
-- 'bubon0lvl1', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '부본0레벨1', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'bf4a673c-5cd5-49e5-81e5-f5afaf4a270a',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'f25a17e9-5c5f-4e9c-bf80-92a9cedf829c', 'df49d067-d554-43b1-87f4-82fb246cec5f',
|
||||
-- 'bubon0lvl2', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '부본0레벨2', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'f25a17e9-5c5f-4e9c-bf80-92a9cedf829c', '0cce35ee-9668-495e-8840-e3d7b5b01b76',
|
||||
-- 'bubon0lvl3', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '부본0레벨3', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'fdccd68f-772f-456e-9f5a-b63f0220ea51',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'f25a17e9-5c5f-4e9c-bf80-92a9cedf829c', 'e7e768d7-1d3d-4ae1-866d-4db1c1f0d9a5',
|
||||
-- 'bubon0lvl4', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '부본0레벨4', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'ab25afb2-3564-491e-82d8-7a0b6ee19d4a',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'cac7b897-2549-4f04-8415-8868f1dcb1da', 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
-- 'chongpan0lvl1', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '총판0레벨1', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'd509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'cac7b897-2549-4f04-8415-8868f1dcb1da', 'df49d067-d554-43b1-87f4-82fb246cec5f',
|
||||
-- 'chongpan0lvl2', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '총판0레벨2', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '125fe2e8-7fe1-425b-81f8-8d0bd4d8a117',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'cac7b897-2549-4f04-8415-8868f1dcb1da', '0cce35ee-9668-495e-8840-e3d7b5b01b76',
|
||||
-- 'chongpan0lvl3', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '총판0레벨3', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '98022947-634e-478c-b214-bc593835af0f',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'cac7b897-2549-4f04-8415-8868f1dcb1da', 'e7e768d7-1d3d-4ae1-866d-4db1c1f0d9a5',
|
||||
-- 'chongpan0lvl4', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '총판0레벨4', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '0655556a-2de5-4cc3-a0ea-b29336d57eb0',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'e11cac11-3825-4f4e-9cd5-39367f23f973', 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
-- 'maejang0lvl1', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '매장0레벨1', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'e11cac11-3825-4f4e-9cd5-39367f23f973', 'df49d067-d554-43b1-87f4-82fb246cec5f',
|
||||
-- 'maejang0lvl2', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '매장0레벨2', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'd4a15304-cd04-4983-a3bf-49aa5dcd6bc1',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'e11cac11-3825-4f4e-9cd5-39367f23f973', '0cce35ee-9668-495e-8840-e3d7b5b01b76',
|
||||
-- 'maejang0lvl3', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '매장0레벨3', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '7293b9e0-8309-43d7-bf41-602f4d441085',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', 'e11cac11-3825-4f4e-9cd5-39367f23f973', 'e7e768d7-1d3d-4ae1-866d-4db1c1f0d9a5',
|
||||
-- 'maejang0lvl4', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '매장0레벨4', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '1dfbb52c-7c88-4cce-89b5-36c71a5a17ff',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4598f07a-86d1-42a4-b038-25706683a7cd', 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
-- 'user0lvl1', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '회원0레벨1', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'fce23cc0-8300-44cd-bf10-b72bd3d38bd6',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4598f07a-86d1-42a4-b038-25706683a7cd', 'df49d067-d554-43b1-87f4-82fb246cec5f',
|
||||
-- 'user0lvl2', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '회원0레벨2', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- '6157b835-1f23-49de-8330-e003ddf7b58e',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4598f07a-86d1-42a4-b038-25706683a7cd', '0cce35ee-9668-495e-8840-e3d7b5b01b76',
|
||||
-- 'user0lvl3', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '회원0레벨3', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- INSERT INTO members(
|
||||
-- id,
|
||||
-- site_id, member_class_id, member_level_id,
|
||||
-- username, password, nickname, mobile_phone_number,
|
||||
-- state
|
||||
-- ) VALUES (
|
||||
-- 'eafcf73c-c98b-44a2-847b-751a3aebbaa6',
|
||||
-- '8429a7ab-b9de-400b-a209-28ff46e22bec', '4598f07a-86d1-42a4-b038-25706683a7cd', 'e7e768d7-1d3d-4ae1-866d-4db1c1f0d9a5',
|
||||
-- 'user0lvl4', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', '회원0레벨4', '',
|
||||
-- 'normal'
|
||||
-- );
|
||||
|
||||
-- member role of administrator
|
||||
INSERT INTO member_roles (member_id, role_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', '96993de5-d628-434d-a6cb-55a84a35db1a');
|
||||
|
||||
-- -- member role of partner
|
||||
-- -- 본사0레벨1
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 본사0레벨2
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 본사0레벨3
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 본사0레벨4
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 대본0레벨1
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 대본0레벨2
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 대본0레벨3
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 대본0레벨4
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 부본0레벨1
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 부본0레벨2
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 부본0레벨3
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 부본0레벨4
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 총판0레벨1
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 총판0레벨2
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 총판0레벨3
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 총판0레벨4
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 매장0레벨1
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 매장0레벨2
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 매장0레벨3
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
-- -- 매장0레벨4
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', 'ac1c4ea4-1de8-46b6-8239-4fd67a1ba205');
|
||||
|
||||
-- -- member role of user
|
||||
-- -- 회원0레벨1
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('1dfbb52c-7c88-4cce-89b5-36c71a5a17ff', 'b6a2b662-e21e-44e7-a96c-dacd86f9d6b8');
|
||||
-- -- 회원0레벨2
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('fce23cc0-8300-44cd-bf10-b72bd3d38bd6', 'b6a2b662-e21e-44e7-a96c-dacd86f9d6b8');
|
||||
-- -- 회원0레벨3
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('6157b835-1f23-49de-8330-e003ddf7b58e', 'b6a2b662-e21e-44e7-a96c-dacd86f9d6b8');
|
||||
-- -- 회원0레벨4
|
||||
-- INSERT INTO member_roles (member_id, role_id) VALUES ('eafcf73c-c98b-44a2-847b-751a3aebbaa6', 'b6a2b662-e21e-44e7-a96c-dacd86f9d6b8');
|
||||
|
||||
|
||||
-- permission of administrator
|
||||
-- identity.signin
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- identity.signout
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- member.create
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- member.delete
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- member.read
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- member.report
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- member.search
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- member.update
|
||||
INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('8239f500-ebf7-4900-9fa9-4a9368a409e4', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
|
||||
-- -- permission of partner
|
||||
-- -- 본사0레벨1
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d2e0c759-ea4c-426b-ad2a-f8ff4750c859', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 본사0레벨2
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ef20589c-3405-4e77-9fd0-2068248b7673', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 본사0레벨3
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('608c74a0-7397-48d5-9be9-db95e758f7a1', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 본사0레벨4
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('661a656a-56e7-4549-b5ca-05c517ae31f1', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 대본0레벨1
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('67910e4b-e31e-41a1-b45c-54b38faea032', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
|
||||
-- -- 대본0레벨2
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('3b6832c3-1e5f-4135-8756-7dd20d38cb5a', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
|
||||
-- -- 대본0레벨3
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('9c60a6c0-704b-4231-8e3f-fbd17e2ecf3e', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
|
||||
-- -- 대본0레벨4
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('62ba1a59-3a3c-447a-a249-769233f4010d', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
|
||||
-- -- 부본0레벨1
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('c305d2e1-8242-433e-9f2d-782012e080ae', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 부본0레벨2
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('bf4a673c-5cd5-49e5-81e5-f5afaf4a270a', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 부본0레벨3
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('40fa38e8-b47e-4ccc-bb2f-16dd9fb9e2e4', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 부본0레벨4
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fdccd68f-772f-456e-9f5a-b63f0220ea51', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 총판0레벨1
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('ab25afb2-3564-491e-82d8-7a0b6ee19d4a', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 총판0레벨2
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d509bb82-35e9-4bd6-81d0-0f0bdd5fdf2f', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 총판0레벨3
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('125fe2e8-7fe1-425b-81f8-8d0bd4d8a117', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 총판0레벨4
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('98022947-634e-478c-b214-bc593835af0f', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
|
||||
-- -- 매장0레벨1
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('0655556a-2de5-4cc3-a0ea-b29336d57eb0', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 매장0레벨2
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('011e28af-d2c8-4c9a-ae64-45ea8a8e6e5d', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 매장0레벨3
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('d4a15304-cd04-4983-a3bf-49aa5dcd6bc1', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- 매장0레벨4
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
-- -- member.create
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', '9d1afd68-bf25-4e0b-8e85-c064d1d0b33f');
|
||||
-- -- member.delete
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', '83304e75-6760-497e-b25f-3ebd6586af34');
|
||||
-- -- member.read
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', '0966592e-a7ff-434d-86cf-17b5fc6dbde8');
|
||||
-- -- member.report
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', 'f29ecfb6-a3f9-46f5-85d9-8a44a1c8df66');
|
||||
-- -- member.search
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', '45d4b3ce-5b1f-487c-a40b-ecb209b58046');
|
||||
-- -- member.update
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('7293b9e0-8309-43d7-bf41-602f4d441085', 'd8165ce7-4135-41ba-b022-c2e7b1346ea6');
|
||||
|
||||
-- -- permission of user
|
||||
-- -- 회원0레벨1
|
||||
-- -- identity.signup
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('1dfbb52c-7c88-4cce-89b5-36c71a5a17ff', 'e71bbb2b-d3f5-43a3-82a1-b5485a65bbbf');
|
||||
-- -- identity.withdraw
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('1dfbb52c-7c88-4cce-89b5-36c71a5a17ff', '68181eee-0b44-4cfa-8cd9-6c95d4369fd5');
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('1dfbb52c-7c88-4cce-89b5-36c71a5a17ff', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('1dfbb52c-7c88-4cce-89b5-36c71a5a17ff', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
|
||||
-- -- 회원0레벨2
|
||||
-- -- identity.signup
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fce23cc0-8300-44cd-bf10-b72bd3d38bd6', 'e71bbb2b-d3f5-43a3-82a1-b5485a65bbbf');
|
||||
-- -- identity.withdraw
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fce23cc0-8300-44cd-bf10-b72bd3d38bd6', '68181eee-0b44-4cfa-8cd9-6c95d4369fd5');
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fce23cc0-8300-44cd-bf10-b72bd3d38bd6', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('fce23cc0-8300-44cd-bf10-b72bd3d38bd6', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
|
||||
-- -- 회원0레벨3
|
||||
-- -- identity.signup
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('6157b835-1f23-49de-8330-e003ddf7b58e', 'e71bbb2b-d3f5-43a3-82a1-b5485a65bbbf');
|
||||
-- -- identity.withdraw
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('6157b835-1f23-49de-8330-e003ddf7b58e', '68181eee-0b44-4cfa-8cd9-6c95d4369fd5');
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('6157b835-1f23-49de-8330-e003ddf7b58e', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('6157b835-1f23-49de-8330-e003ddf7b58e', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
|
||||
-- -- 회원0레벨4
|
||||
-- -- identity.signup
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('eafcf73c-c98b-44a2-847b-751a3aebbaa6', 'e71bbb2b-d3f5-43a3-82a1-b5485a65bbbf');
|
||||
-- -- identity.withdraw
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('eafcf73c-c98b-44a2-847b-751a3aebbaa6', '68181eee-0b44-4cfa-8cd9-6c95d4369fd5');
|
||||
-- -- identity.signin
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('eafcf73c-c98b-44a2-847b-751a3aebbaa6', '75588b0c-ee9e-4af1-a183-c43f67b5aa9b');
|
||||
-- -- identity.signout
|
||||
-- INSERT INTO member_permissions (member_id, resource_action_id) VALUES ('eafcf73c-c98b-44a2-847b-751a3aebbaa6', '37b99823-188b-4b30-afb7-815a7e79662b');
|
||||
|
||||
INSERT INTO member_bank_accounts (id, member_id, bank_id, name, account_number, exchange_password, memo, created_at, updated_at) VALUES ('fa3a48fa-bbd4-4319-8997-38ba9dffa7b3', 'c4c8c3c7-3ad7-4a89-a9b2-2df8c9c66002', '816eff0d-db96-4753-98e3-36035a9a012b', '본사01', '123123123123', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', NULL, 1662368913867, 1662368913867);
|
||||
INSERT INTO member_bank_accounts (id, member_id, bank_id, name, account_number, exchange_password, memo, created_at, updated_at) VALUES ('a9ea700f-411f-470e-91c2-3820df90da08', '8f335e71-6b3a-4661-935f-ad71ea90a529', '20c9c093-fd6a-463d-9de4-e93d0db0e7eb', '대본01', '123123123123', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', NULL, 1662368955042, 1662368955042);
|
||||
INSERT INTO member_bank_accounts (id, member_id, bank_id, name, account_number, exchange_password, memo, created_at, updated_at) VALUES ('8b5fc1a2-e69a-43ff-a2a7-85959115fc9a', 'b378d495-12c5-42ea-a717-f1fc81eae2d2', '20c9c093-fd6a-463d-9de4-e93d0db0e7eb', '부본01', '123123123123', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', NULL, 1662368992363, 1662368992363);
|
||||
INSERT INTO member_bank_accounts (id, member_id, bank_id, name, account_number, exchange_password, memo, created_at, updated_at) VALUES ('97017b4d-b413-4e8e-b898-97eba6cf5d61', 'ab59d6d8-c5d6-4bb6-a9f7-1658801f78fc', '816eff0d-db96-4753-98e3-36035a9a012b', '총판01', '13123132123123', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', NULL, 1662369018968, 1662369018968);
|
||||
INSERT INTO member_bank_accounts (id, member_id, bank_id, name, account_number, exchange_password, memo, created_at, updated_at) VALUES ('29fa1219-0736-4bf7-b856-0ee65fc5a26a', 'df062e89-91f2-42ac-ba84-4f8fd37ea840', '20c9c093-fd6a-463d-9de4-e93d0db0e7eb', '매장01', '28282918282', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$jruoYOS29M2SwAyQNVre/ND4kNWcIg3++24uGl9+2BI', NULL, 1662369066773, 1662369066773);
|
||||
INSERT INTO member_bank_accounts (id, member_id, bank_id, name, account_number, exchange_password, memo, created_at, updated_at) VALUES ('2f807e19-86d3-4092-b277-9da6b2542e41', '2cc97c3b-0d82-4965-a68e-6aced1e179ec', '816eff0d-db96-4753-98e3-36035a9a012b', '테스트01', '123123123', '$argon2i$v=19$m=4096,t=3,p=1$QCReKikxMzU3OXdyeWlwUUVUVU8$oO8rlAVRUAAXS9Y/rULDehwqnqwpUtlDjcNuaxHCdRU', NULL, 1662369125185, 1662369125185);
|
||||
|
||||
|
||||
INSERT INTO member_game_settings (id, member_id, can_bet_casino, can_bet_slot, can_bet_powerball, can_bet_powerladder, can_bet_eos, can_bet_bogglepowerball, created_at, updated_at) VALUES ('2ab6656b-6426-44c6-a59d-9ee96c36de0a', 'c4c8c3c7-3ad7-4a89-a9b2-2df8c9c66002', true, true, true, true, true, true, 1662368913875, 1662368913875);
|
||||
INSERT INTO member_game_settings (id, member_id, can_bet_casino, can_bet_slot, can_bet_powerball, can_bet_powerladder, can_bet_eos, can_bet_bogglepowerball, created_at, updated_at) VALUES ('c5452e47-9f0a-4551-b047-82a7c95a210a', '8f335e71-6b3a-4661-935f-ad71ea90a529', true, true, true, true, true, true, 1662368955051, 1662368955051);
|
||||
INSERT INTO member_game_settings (id, member_id, can_bet_casino, can_bet_slot, can_bet_powerball, can_bet_powerladder, can_bet_eos, can_bet_bogglepowerball, created_at, updated_at) VALUES ('6d288c88-b840-471c-b9c5-9ea0019dfe2c', 'b378d495-12c5-42ea-a717-f1fc81eae2d2', true, true, true, true, true, true, 1662368992371, 1662368992371);
|
||||
INSERT INTO member_game_settings (id, member_id, can_bet_casino, can_bet_slot, can_bet_powerball, can_bet_powerladder, can_bet_eos, can_bet_bogglepowerball, created_at, updated_at) VALUES ('f6236f33-7a80-43da-b030-1577f9773d54', 'ab59d6d8-c5d6-4bb6-a9f7-1658801f78fc', true, true, true, true, true, true, 1662369018975, 1662369018975);
|
||||
INSERT INTO member_game_settings (id, member_id, can_bet_casino, can_bet_slot, can_bet_powerball, can_bet_powerladder, can_bet_eos, can_bet_bogglepowerball, created_at, updated_at) VALUES ('c79c1b97-3ca2-464c-a39f-d736909fee4d', 'df062e89-91f2-42ac-ba84-4f8fd37ea840', true, true, true, true, true, true, 1662369066780, 1662369066780);
|
||||
INSERT INTO member_game_settings (id, member_id, can_bet_casino, can_bet_slot, can_bet_powerball, can_bet_powerladder, can_bet_eos, can_bet_bogglepowerball, created_at, updated_at) VALUES ('ef71c575-491a-476f-afb9-3d28ee735d66', '2cc97c3b-0d82-4965-a68e-6aced1e179ec', true, true, true, true, true, true, 1662369125194, 1662369125194);
|
||||
|
||||
|
||||
|
||||
INSERT INTO member_settlement_settings (id, member_id, can_exchange, can_first_charge_comp, can_per_charge_comp, manual_payment_type_for_partner, settlement_type, rate_casino, rate_casino_loosing, rate_casino_bacara, rate_casino_roulette, rate_casino_dragon_tiger, rate_slot, rate_slot_loosing, rate_powerball_single, rate_powerball_combo, rate_powerladder_single, rate_powerladder_combo, rate_eos_single, rate_eos_combo, rate_bogglepowerball_single, rate_bogglepowerball_combo, created_at, updated_at) VALUES ('59512e48-ce36-4f1f-9954-194dc14ed245', 'c4c8c3c7-3ad7-4a89-a9b2-2df8c9c66002', true, false, false, 'all_child_partner', 'rolling', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1662368913880, 1662368913880);
|
||||
INSERT INTO member_settlement_settings (id, member_id, can_exchange, can_first_charge_comp, can_per_charge_comp, manual_payment_type_for_partner, settlement_type, rate_casino, rate_casino_loosing, rate_casino_bacara, rate_casino_roulette, rate_casino_dragon_tiger, rate_slot, rate_slot_loosing, rate_powerball_single, rate_powerball_combo, rate_powerladder_single, rate_powerladder_combo, rate_eos_single, rate_eos_combo, rate_bogglepowerball_single, rate_bogglepowerball_combo, created_at, updated_at) VALUES ('b344bab9-6854-4ba3-8a78-79a4423d1be0', '8f335e71-6b3a-4661-935f-ad71ea90a529', true, false, false, 'all_child_partner', 'rolling', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1662368955058, 1662368955058);
|
||||
INSERT INTO member_settlement_settings (id, member_id, can_exchange, can_first_charge_comp, can_per_charge_comp, manual_payment_type_for_partner, settlement_type, rate_casino, rate_casino_loosing, rate_casino_bacara, rate_casino_roulette, rate_casino_dragon_tiger, rate_slot, rate_slot_loosing, rate_powerball_single, rate_powerball_combo, rate_powerladder_single, rate_powerladder_combo, rate_eos_single, rate_eos_combo, rate_bogglepowerball_single, rate_bogglepowerball_combo, created_at, updated_at) VALUES ('ad97b23a-abe0-4f19-95a4-7d827775f27c', 'b378d495-12c5-42ea-a717-f1fc81eae2d2', true, false, false, 'all_child_partner', 'rolling', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1662368992378, 1662368992378);
|
||||
INSERT INTO member_settlement_settings (id, member_id, can_exchange, can_first_charge_comp, can_per_charge_comp, manual_payment_type_for_partner, settlement_type, rate_casino, rate_casino_loosing, rate_casino_bacara, rate_casino_roulette, rate_casino_dragon_tiger, rate_slot, rate_slot_loosing, rate_powerball_single, rate_powerball_combo, rate_powerladder_single, rate_powerladder_combo, rate_eos_single, rate_eos_combo, rate_bogglepowerball_single, rate_bogglepowerball_combo, created_at, updated_at) VALUES ('3ac9bccc-6fc0-45a3-ae5d-65af6ea6457a', 'ab59d6d8-c5d6-4bb6-a9f7-1658801f78fc', true, false, false, 'all_child_partner', 'rolling', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1662369018982, 1662369018982);
|
||||
INSERT INTO member_settlement_settings (id, member_id, can_exchange, can_first_charge_comp, can_per_charge_comp, manual_payment_type_for_partner, settlement_type, rate_casino, rate_casino_loosing, rate_casino_bacara, rate_casino_roulette, rate_casino_dragon_tiger, rate_slot, rate_slot_loosing, rate_powerball_single, rate_powerball_combo, rate_powerladder_single, rate_powerladder_combo, rate_eos_single, rate_eos_combo, rate_bogglepowerball_single, rate_bogglepowerball_combo, created_at, updated_at) VALUES ('a9e0561d-a6e8-4316-8e38-7f499c700d2b', 'df062e89-91f2-42ac-ba84-4f8fd37ea840', true, false, false, 'all_child_partner', 'rolling', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1662369066787, 1662369066787);
|
||||
INSERT INTO member_settlement_settings (id, member_id, can_exchange, can_first_charge_comp, can_per_charge_comp, manual_payment_type_for_partner, settlement_type, rate_casino, rate_casino_loosing, rate_casino_bacara, rate_casino_roulette, rate_casino_dragon_tiger, rate_slot, rate_slot_loosing, rate_powerball_single, rate_powerball_combo, rate_powerladder_single, rate_powerladder_combo, rate_eos_single, rate_eos_combo, rate_bogglepowerball_single, rate_bogglepowerball_combo, created_at, updated_at) VALUES ('1b3015ed-99f2-4058-93b8-1eeca24d9844', '2cc97c3b-0d82-4965-a68e-6aced1e179ec', true, false, false, 'all_child_partner', 'rolling', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1662369125200, 1662369125200);
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod composition;
|
||||
///
|
||||
pub mod models;
|
|
@ -1,308 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use crate::repositories::{
|
||||
bank::models::Bank, member::schema::MemberState, member_balance::models::MemberBalance,
|
||||
member_class::models::MemberClass, member_game_setting::models::MemberGameSetting,
|
||||
member_level::models::MemberLevel, member_settlement_setting::models::MemberSettlementSetting,
|
||||
site::models::Site,
|
||||
};
|
||||
use diesel::deserialize::QueryableByName;
|
||||
|
||||
///
|
||||
#[derive(PartialEq, PartialOrd, Debug, Clone)]
|
||||
pub struct _MemberModel {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub site: Site,
|
||||
///
|
||||
pub member_class: MemberClass,
|
||||
///
|
||||
pub member_level: MemberLevel,
|
||||
///
|
||||
pub bank_account: Option<MemberBankAccountModel>,
|
||||
///
|
||||
pub username: String,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub nickname: String,
|
||||
///
|
||||
pub parent_member_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub child_member_count: i64,
|
||||
///
|
||||
pub mobile_phone_number: Option<String>,
|
||||
///
|
||||
pub state: MemberState,
|
||||
///
|
||||
pub state_changed_at: Option<i64>,
|
||||
///
|
||||
pub member_game_setting: Option<MemberGameSetting>,
|
||||
///
|
||||
pub member_settlement_setting: Option<MemberSettlementSetting>,
|
||||
///
|
||||
pub member_balance: Option<MemberBalance>,
|
||||
///
|
||||
pub last_signined_ip: Option<String>,
|
||||
///
|
||||
pub last_signined_at: Option<i64>,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
///
|
||||
pub deleted_at: Option<i64>,
|
||||
}
|
||||
|
||||
impl QueryableByName<diesel::pg::Pg> for _MemberModel {
|
||||
fn build<R: diesel::row::NamedRow<diesel::pg::Pg>>(row: &R) -> diesel::deserialize::Result<Self> {
|
||||
let site = Site {
|
||||
id: row.get("s_id")?,
|
||||
url: row.get("s_url")?,
|
||||
name: row.get("s_name")?,
|
||||
path: row.get("s_path")?,
|
||||
show: row.get("s_show")?,
|
||||
can_use: row.get("s_can_use")?,
|
||||
memo: row.get("s_memo")?,
|
||||
expires_at: row.get("s_expires_at")?,
|
||||
created_at: row.get("s_created_at")?,
|
||||
updated_at: row.get("s_updated_at")?,
|
||||
};
|
||||
|
||||
let member_class = MemberClass {
|
||||
id: row.get("mc_id")?,
|
||||
parent_id: row.get("mc_parent_id")?,
|
||||
name: row.get("mc_name")?,
|
||||
show: row.get("mc_show")?,
|
||||
created_at: row.get("mc_created_at")?,
|
||||
updated_at: row.get("mc_updated_at")?,
|
||||
};
|
||||
|
||||
let member_level = MemberLevel {
|
||||
id: row.get("ml_id")?,
|
||||
name: row.get("ml_name")?,
|
||||
show: row.get("ml_show")?,
|
||||
sort_order: row.get("ml_sort_order")?,
|
||||
created_at: row.get("ml_created_at")?,
|
||||
updated_at: row.get("ml_updated_at")?,
|
||||
};
|
||||
|
||||
let member_game_setting = match row
|
||||
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("mgs_id")?
|
||||
{
|
||||
Some(_) => Some(MemberGameSetting {
|
||||
id: row.get("mgs_id")?,
|
||||
member_id: row.get("mgs_member_id")?,
|
||||
can_bet_casino: row.get("mgs_can_bet_casino")?,
|
||||
can_bet_slot: row.get("mgs_can_bet_slot")?,
|
||||
can_bet_powerball: row.get("mgs_can_bet_powerball")?,
|
||||
can_bet_powerladder: row.get("mgs_can_bet_powerladder")?,
|
||||
can_bet_eos: row.get("mgs_can_bet_eos")?,
|
||||
can_bet_bogglepowerball: row.get("mgs_can_bet_bogglepowerball")?,
|
||||
created_at: row.get("mgs_created_at")?,
|
||||
updated_at: row.get("mgs_updated_at")?,
|
||||
}),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let member_settlement_setting = match row
|
||||
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("mss_id")?
|
||||
{
|
||||
Some(_) => Some(MemberSettlementSetting {
|
||||
id: row.get("mss_id")?,
|
||||
member_id: row.get("mss_member_id")?,
|
||||
can_exchange: row.get("mss_can_exchange")?,
|
||||
can_first_charge_comp: row.get("mss_can_first_charge_comp")?,
|
||||
can_per_charge_comp: row.get("mss_can_per_charge_comp")?,
|
||||
manual_payment_type_for_partner: row.get("mss_manual_payment_type_for_partner")?,
|
||||
settlement_type: row.get("mss_settlement_type")?,
|
||||
rate_casino: row.get("mss_rate_casino")?,
|
||||
rate_casino_loosing: row.get("mss_rate_casino_loosing")?,
|
||||
rate_casino_bacara: row.get("mss_rate_casino_bacara")?,
|
||||
rate_casino_roulette: row.get("mss_rate_casino_roulette")?,
|
||||
rate_casino_dragon_tiger: row.get("mss_rate_casino_dragon_tiger")?,
|
||||
rate_slot: row.get("mss_rate_slot")?,
|
||||
rate_slot_loosing: row.get("mss_rate_slot_loosing")?,
|
||||
rate_powerball_single: row.get("mss_rate_powerball_single")?,
|
||||
rate_powerball_combo: row.get("mss_rate_powerball_combo")?,
|
||||
rate_powerladder_single: row.get("mss_rate_powerladder_single")?,
|
||||
rate_powerladder_combo: row.get("mss_rate_powerladder_combo")?,
|
||||
rate_eos_single: row.get("mss_rate_eos_single")?,
|
||||
rate_eos_combo: row.get("mss_rate_eos_combo")?,
|
||||
rate_bogglepowerball_single: row.get("mss_rate_bogglepowerball_single")?,
|
||||
rate_bogglepowerball_combo: row.get("mss_rate_bogglepowerball_combo")?,
|
||||
created_at: row.get("mss_created_at")?,
|
||||
updated_at: row.get("mss_updated_at")?,
|
||||
}),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let member_bank_account = match row
|
||||
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("mba_id")?
|
||||
{
|
||||
Some(_) => {
|
||||
let bank = Bank {
|
||||
id: row.get("mba_b_id")?,
|
||||
name: row.get("mba_b_name")?,
|
||||
sort_order: row.get("mba_b_sort_order")?,
|
||||
show: row.get("mba_b_show")?,
|
||||
can_use: row.get("mba_b_can_use")?,
|
||||
memo: row.get("mba_b_memo")?,
|
||||
created_at: row.get("mba_b_created_at")?,
|
||||
updated_at: row.get("mba_b_updated_at")?,
|
||||
};
|
||||
|
||||
Some(MemberBankAccountModel {
|
||||
id: row.get("mba_id")?,
|
||||
member_id: row.get("mba_member_id")?,
|
||||
bank,
|
||||
name: row.get("mba_name")?,
|
||||
account_number: row.get("mba_account_number")?,
|
||||
exchange_password: row.get("mba_exchange_password")?,
|
||||
memo: row.get("mba_memo")?,
|
||||
created_at: row.get("mba_created_at")?,
|
||||
updated_at: row.get("mba_updated_at")?,
|
||||
})
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
|
||||
let member_balance = match row
|
||||
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("mb_id")?
|
||||
{
|
||||
Some(_) => Some(MemberBalance {
|
||||
id: row.get("mb_id")?,
|
||||
member_id: row.get("mb_member_id")?,
|
||||
balance: row.get("mb_balance")?,
|
||||
balance_bota: row.get("mb_balance_bota")?,
|
||||
balance_sum: row.get("mb_balance_sum")?,
|
||||
created_at: row.get("mb_created_at")?,
|
||||
updated_at: row.get("mb_updated_at")?,
|
||||
}),
|
||||
None => None,
|
||||
};
|
||||
|
||||
Ok(_MemberModel {
|
||||
id: row.get("m_id")?,
|
||||
site,
|
||||
member_class,
|
||||
member_level,
|
||||
username: row.get("m_username")?,
|
||||
password: row.get("m_password")?,
|
||||
nickname: row.get("m_nickname")?,
|
||||
mobile_phone_number: row.get("m_mobile_phone_number")?,
|
||||
state: row.get("m_state")?,
|
||||
state_changed_at: row.get("m_state_changed_at")?,
|
||||
member_game_setting,
|
||||
member_settlement_setting,
|
||||
member_balance,
|
||||
bank_account: member_bank_account,
|
||||
parent_member_id: row.get("m_parent_member_id")?,
|
||||
child_member_count: row.get("m_child_member_count")?,
|
||||
last_signined_ip: row.get("m_last_signined_ip")?,
|
||||
last_signined_at: row.get("m_last_signined_at")?,
|
||||
created_at: row.get("m_created_at")?,
|
||||
updated_at: row.get("m_updated_at")?,
|
||||
deleted_at: row.get("m_deleted_at")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct MemberModel {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub site: Site,
|
||||
///
|
||||
pub member_class: MemberClass,
|
||||
///
|
||||
pub member_level: MemberLevel,
|
||||
///
|
||||
pub bank_account: Option<MemberBankAccountModel>,
|
||||
///
|
||||
pub username: String,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub nickname: String,
|
||||
///
|
||||
pub parent_member: Option<Box<MemberModel>>,
|
||||
///
|
||||
pub children_count: Vec<i64>,
|
||||
///
|
||||
pub child_member_count: i64,
|
||||
///
|
||||
pub mobile_phone_number: Option<String>,
|
||||
///
|
||||
pub state: MemberState,
|
||||
///
|
||||
pub state_changed_at: Option<i64>,
|
||||
///
|
||||
pub member_game_setting: Option<MemberGameSetting>,
|
||||
///
|
||||
pub member_settlement_setting: Option<MemberSettlementSetting>,
|
||||
///
|
||||
pub member_balance: Option<MemberBalance>,
|
||||
///
|
||||
pub last_signined_ip: Option<String>,
|
||||
///
|
||||
pub last_signined_at: Option<i64>,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
///
|
||||
pub deleted_at: Option<i64>,
|
||||
}
|
||||
|
||||
pub fn from_member_model(_m: &_MemberModel, p: Option<MemberModel>, c: Vec<i64>) -> MemberModel {
|
||||
MemberModel {
|
||||
id: _m.id,
|
||||
site: _m.site.clone(),
|
||||
member_class: _m.member_class.clone(),
|
||||
member_level: _m.member_level.clone(),
|
||||
bank_account: _m.bank_account.clone(),
|
||||
username: _m.username.clone(),
|
||||
password: _m.password.clone(),
|
||||
nickname: _m.nickname.clone(),
|
||||
parent_member: p.map(Box::new),
|
||||
children_count: c,
|
||||
child_member_count: _m.child_member_count,
|
||||
mobile_phone_number: _m.mobile_phone_number.clone(),
|
||||
state: _m.state,
|
||||
state_changed_at: _m.state_changed_at,
|
||||
member_game_setting: _m.member_game_setting.clone(),
|
||||
member_settlement_setting: _m.member_settlement_setting.clone(),
|
||||
member_balance: _m.member_balance.clone(),
|
||||
last_signined_ip: _m.last_signined_ip.clone(),
|
||||
last_signined_at: _m.last_signined_at,
|
||||
created_at: _m.created_at,
|
||||
updated_at: _m.updated_at,
|
||||
deleted_at: _m.deleted_at,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Eq, Hash, PartialEq, PartialOrd, Debug, Clone)]
|
||||
pub struct MemberBankAccountModel {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub bank: Bank,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub exchange_password: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
|
@ -1,203 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
use super::models;
|
||||
use crate::repositories;
|
||||
use diesel::{result::Error, sql_query, RunQueryDsl};
|
||||
use std::fmt::Write;
|
||||
|
||||
static MEMBER_QUERY: &str = "
|
||||
SELECT
|
||||
mbd.id as mbd_id,
|
||||
mbd.member_id as mbd_member_id,
|
||||
mbd.name as mbd_name,
|
||||
mbd.amount as mbd_amount,
|
||||
mbd.memo as mbd_memo,
|
||||
mbd.state as mbd_state,
|
||||
mbd.state_changed_at as mbd_state_changed_at,
|
||||
mbd.created_at as mbd_created_at,
|
||||
mbd.updated_at as mbd_updated_at,
|
||||
|
||||
_m.id as _m_id,
|
||||
_m.site_id as _m_site_id,
|
||||
_m.member_class_id as _m_member_class_id,
|
||||
_m.member_level_id as _m_member_level_id,
|
||||
_m.username as _m_username,
|
||||
_m.password as _m_password,
|
||||
_m.nickname as _m_nickname,
|
||||
_m.mobile_phone_number as _m_mobile_phone_number,
|
||||
_m.state as _m_state,
|
||||
_m.state_changed_at as _m_state_changed_at,
|
||||
_m.parent_member_id as _m_parent_member_id,
|
||||
_m.child_member_count as _m_child_member_count,
|
||||
_m.last_signined_ip as _m_last_signined_ip,
|
||||
_m.last_signined_at as _m_last_signined_at,
|
||||
_m.created_at as _m_created_at,
|
||||
_m.updated_at as _m_updated_at,
|
||||
_m.deleted_at as _m_deleted_at
|
||||
|
||||
FROM member_bank_deposits as mbd
|
||||
INNER JOIN members _m
|
||||
ON _m.id = mbd.member_id
|
||||
";
|
||||
|
||||
pub struct Composition {}
|
||||
|
||||
impl std::fmt::Debug for Composition {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Composition of members").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Composition {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Composition {
|
||||
///
|
||||
pub fn new() -> Composition {
|
||||
Composition {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBankDepositModel>, Error> {
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
mbd.id = $1
|
||||
",
|
||||
MEMBER_QUERY
|
||||
);
|
||||
|
||||
match sql_query(query)
|
||||
.bind::<diesel::sql_types::Uuid, _>(id)
|
||||
.get_result::<models::MemberBankDepositModel>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn selects(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
ids: Vec<uuid::Uuid>,
|
||||
) -> Result<Vec<models::MemberBankDepositModel>, Error> {
|
||||
if ids.is_empty() {
|
||||
return Ok(vec![]);
|
||||
}
|
||||
|
||||
let mut query_where_id_in = String::new();
|
||||
|
||||
for id in ids {
|
||||
if !query_where_id_in.is_empty() {
|
||||
write!(&mut query_where_id_in, " , ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
write!(&mut query_where_id_in, " '{}' ", id)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
mbd.id IN ({})
|
||||
",
|
||||
MEMBER_QUERY, query_where_id_in
|
||||
);
|
||||
|
||||
println!("query: {}", query);
|
||||
|
||||
match sql_query(query).get_results::<models::MemberBankDepositModel>(conn) {
|
||||
Ok(m) => Ok(m),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(vec![]),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &repositories::member_bank_deposit::models::FindAll,
|
||||
) -> Result<Vec<models::MemberBankDepositModel>, Error> {
|
||||
let mut query = String::new();
|
||||
write!(&mut query, "{}", MEMBER_QUERY)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
|
||||
let mut query_where = String::new();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbd.member_id = '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbd.name like '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = s.amount {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbd.amount = '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbd.memo like '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbd.state = '{:?}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
}
|
||||
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query, " WHERE {}", query_where)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
println!("query: {}", query);
|
||||
|
||||
match sql_query(query).get_results::<models::MemberBankDepositModel>(conn) {
|
||||
Ok(m) => Ok(m),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(vec![]),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod composition;
|
||||
///
|
||||
pub mod models;
|
|
@ -1,64 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use crate::repositories::member::models::Member as _Member;
|
||||
use crate::repositories::member_bank_deposit::schema::MemberBankDepositState;
|
||||
use diesel::deserialize::QueryableByName;
|
||||
|
||||
///
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct MemberBankDepositModel {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member: _Member,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub state: MemberBankDepositState,
|
||||
///
|
||||
pub state_changed_at: i64,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
impl QueryableByName<diesel::pg::Pg> for MemberBankDepositModel {
|
||||
fn build<R: diesel::row::NamedRow<diesel::pg::Pg>>(row: &R) -> diesel::deserialize::Result<Self> {
|
||||
let member = _Member {
|
||||
id: row.get("_m_id")?,
|
||||
site_id: row.get("_m_site_id")?,
|
||||
member_class_id: row.get("_m_member_class_id")?,
|
||||
member_level_id: row.get("_m_member_level_id")?,
|
||||
username: row.get("_m_username")?,
|
||||
password: row.get("_m_password")?,
|
||||
nickname: row.get("_m_nickname")?,
|
||||
mobile_phone_number: row.get("_m_mobile_phone_number")?,
|
||||
state: row.get("_m_state")?,
|
||||
state_changed_at: row.get("_m_state_changed_at")?,
|
||||
parent_member_id: row.get("_m_parent_member_id")?,
|
||||
child_member_count: row.get("_m_child_member_count")?,
|
||||
last_signined_ip: row.get("_m_last_signined_ip")?,
|
||||
last_signined_at: row.get("_m_last_signined_at")?,
|
||||
created_at: row.get("_m_created_at")?,
|
||||
updated_at: row.get("_m_updated_at")?,
|
||||
deleted_at: row.get("_m_deleted_at")?,
|
||||
};
|
||||
|
||||
Ok(MemberBankDepositModel {
|
||||
id: row.get("mbd_id")?,
|
||||
member,
|
||||
name: row.get("mbd_name")?,
|
||||
amount: row.get("mbd_amount")?,
|
||||
memo: row.get("mbd_memo")?,
|
||||
state: row.get("mbd_state")?,
|
||||
state_changed_at: row.get("mbd_state_changed_at")?,
|
||||
created_at: row.get("mbd_created_at")?,
|
||||
updated_at: row.get("mbd_updated_at")?,
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,249 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
use super::models;
|
||||
use crate::repositories;
|
||||
use diesel::{result::Error, sql_query, RunQueryDsl};
|
||||
use std::fmt::Write;
|
||||
|
||||
static MEMBER_QUERY: &str = "
|
||||
SELECT
|
||||
mbw.id as mbw_id,
|
||||
mbw.member_id as mbw_member_id,
|
||||
mbw.bank_name as mbw_bank_name,
|
||||
mbw.name as mbw_name,
|
||||
mbw.account_number as mbw_account_number,
|
||||
mbw.amount as mbw_amount,
|
||||
mbw.password as mbw_password,
|
||||
mbw.memo as mbw_memo,
|
||||
mbw.state as mbw_state,
|
||||
mbw.state_changed_at as mbw_state_changed_at,
|
||||
mbw.created_at as mbw_created_at,
|
||||
mbw.updated_at as mbw_updated_at,
|
||||
|
||||
_m.id as _m_id,
|
||||
_m.site_id as _m_site_id,
|
||||
_m.member_class_id as _m_member_class_id,
|
||||
_m.member_level_id as _m_member_level_id,
|
||||
_m.username as _m_username,
|
||||
_m.password as _m_password,
|
||||
_m.nickname as _m_nickname,
|
||||
_m.mobile_phone_number as _m_mobile_phone_number,
|
||||
_m.state as _m_state,
|
||||
_m.state_changed_at as _m_state_changed_at,
|
||||
_m.parent_member_id as _m_parent_member_id,
|
||||
_m.child_member_count as _m_child_member_count,
|
||||
_m.last_signined_ip as _m_last_signined_ip,
|
||||
_m.last_signined_at as _m_last_signined_at,
|
||||
_m.created_at as _m_created_at,
|
||||
_m.updated_at as _m_updated_at,
|
||||
_m.deleted_at as _m_deleted_at
|
||||
|
||||
FROM member_bank_withdraws as mbw
|
||||
INNER JOIN members _m
|
||||
ON _m.id = mbw.member_id
|
||||
";
|
||||
|
||||
pub struct Composition {}
|
||||
|
||||
impl std::fmt::Debug for Composition {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Composition of members").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Composition {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Composition {
|
||||
///
|
||||
pub fn new() -> Composition {
|
||||
Composition {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBankWithdrawModel>, Error> {
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
mbw.id = $1
|
||||
",
|
||||
MEMBER_QUERY
|
||||
);
|
||||
|
||||
match sql_query(query)
|
||||
.bind::<diesel::sql_types::Uuid, _>(id)
|
||||
.get_result::<models::MemberBankWithdrawModel>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn selects(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
ids: Vec<uuid::Uuid>,
|
||||
) -> Result<Vec<models::MemberBankWithdrawModel>, Error> {
|
||||
if ids.is_empty() {
|
||||
return Ok(vec![]);
|
||||
}
|
||||
|
||||
let mut query_where_id_in = String::new();
|
||||
|
||||
for id in ids {
|
||||
if !query_where_id_in.is_empty() {
|
||||
write!(&mut query_where_id_in, " , ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
write!(&mut query_where_id_in, " '{}' ", id)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
mbw.id IN ({})
|
||||
",
|
||||
MEMBER_QUERY, query_where_id_in
|
||||
);
|
||||
|
||||
println!("query: {}", query);
|
||||
|
||||
match sql_query(query).get_results::<models::MemberBankWithdrawModel>(conn) {
|
||||
Ok(m) => Ok(m),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(vec![]),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_by_username(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
username: &str,
|
||||
) -> Result<Option<models::MemberBankWithdrawModel>, Error> {
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
_m.username = $1
|
||||
",
|
||||
MEMBER_QUERY
|
||||
);
|
||||
|
||||
match sql_query(query)
|
||||
.bind::<diesel::sql_types::Text, _>(username)
|
||||
.get_result::<models::MemberBankWithdrawModel>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &repositories::member_bank_withdraw::models::FindAll,
|
||||
) -> Result<Vec<models::MemberBankWithdrawModel>, Error> {
|
||||
let mut query = String::new();
|
||||
write!(&mut query, "{}", MEMBER_QUERY)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
|
||||
let mut query_where = String::new();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbw.member_id = '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = &s.bank_name_like {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbw.bank_name like '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbw.name like '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = &s.account_number_like {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbw.account_number like '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = s.amount {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbw.amount = '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbw.memo like '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mbw.state = '{:?}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
}
|
||||
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query, " WHERE {}", query_where)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
println!("query: {}", query);
|
||||
|
||||
match sql_query(query).get_results::<models::MemberBankWithdrawModel>(conn) {
|
||||
Ok(m) => Ok(m),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(vec![]),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod composition;
|
||||
///
|
||||
pub mod models;
|
|
@ -1,73 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use crate::repositories::member::models::Member as _Member;
|
||||
use crate::repositories::member_bank_withdraw::schema::MemberBankWithdrawState;
|
||||
use diesel::deserialize::QueryableByName;
|
||||
|
||||
///
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct MemberBankWithdrawModel {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member: _Member,
|
||||
///
|
||||
pub bank_name: String,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub state: MemberBankWithdrawState,
|
||||
///
|
||||
pub state_changed_at: i64,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
impl QueryableByName<diesel::pg::Pg> for MemberBankWithdrawModel {
|
||||
fn build<R: diesel::row::NamedRow<diesel::pg::Pg>>(row: &R) -> diesel::deserialize::Result<Self> {
|
||||
let member = _Member {
|
||||
id: row.get("_m_id")?,
|
||||
site_id: row.get("_m_site_id")?,
|
||||
member_class_id: row.get("_m_member_class_id")?,
|
||||
member_level_id: row.get("_m_member_level_id")?,
|
||||
username: row.get("_m_username")?,
|
||||
password: row.get("_m_password")?,
|
||||
nickname: row.get("_m_nickname")?,
|
||||
mobile_phone_number: row.get("_m_mobile_phone_number")?,
|
||||
state: row.get("_m_state")?,
|
||||
state_changed_at: row.get("_m_state_changed_at")?,
|
||||
parent_member_id: row.get("_m_parent_member_id")?,
|
||||
child_member_count: row.get("_m_child_member_count")?,
|
||||
last_signined_ip: row.get("_m_last_signined_ip")?,
|
||||
last_signined_at: row.get("_m_last_signined_at")?,
|
||||
created_at: row.get("_m_created_at")?,
|
||||
updated_at: row.get("_m_updated_at")?,
|
||||
deleted_at: row.get("_m_deleted_at")?,
|
||||
};
|
||||
|
||||
Ok(MemberBankWithdrawModel {
|
||||
id: row.get("mbw_id")?,
|
||||
member,
|
||||
bank_name: row.get("mbw_bank_name")?,
|
||||
name: row.get("mbw_name")?,
|
||||
account_number: row.get("mbw_account_number")?,
|
||||
amount: row.get("mbw_amount")?,
|
||||
password: row.get("mbw_password")?,
|
||||
memo: row.get("mbw_memo")?,
|
||||
state: row.get("mbw_state")?,
|
||||
state_changed_at: row.get("mbw_state_changed_at")?,
|
||||
created_at: row.get("mbw_created_at")?,
|
||||
updated_at: row.get("mbw_updated_at")?,
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,211 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
use super::models;
|
||||
use crate::repositories;
|
||||
use diesel::{result::Error, sql_query, RunQueryDsl};
|
||||
use std::fmt::Write;
|
||||
|
||||
static MEMBER_QUERY: &str = "
|
||||
SELECT
|
||||
mr.id as mr_id,
|
||||
mr.member_id as mr_member_id,
|
||||
mr.can_use as mr_can_use,
|
||||
mr.memo as mr_memo,
|
||||
mr.created_at as mr_created_at,
|
||||
mr.updated_at as mr_updated_at,
|
||||
|
||||
_m.id as _m_id,
|
||||
_m.site_id as _m_site_id,
|
||||
_m.member_class_id as _m_member_class_id,
|
||||
_m.member_level_id as _m_member_level_id,
|
||||
_m.username as _m_username,
|
||||
_m.password as _m_password,
|
||||
_m.nickname as _m_nickname,
|
||||
_m.mobile_phone_number as _m_mobile_phone_number,
|
||||
_m.state as _m_state,
|
||||
_m.state_changed_at as _m_state_changed_at,
|
||||
_m.parent_member_id as _m_parent_member_id,
|
||||
_m.child_member_count as _m_child_member_count,
|
||||
_m.last_signined_ip as _m_last_signined_ip,
|
||||
_m.last_signined_at as _m_last_signined_at,
|
||||
_m.created_at as _m_created_at,
|
||||
_m.updated_at as _m_updated_at,
|
||||
_m.deleted_at as _m_deleted_at
|
||||
|
||||
FROM member_referrers as mr
|
||||
INNER JOIN members _m
|
||||
ON _m.id = mr.member_id
|
||||
";
|
||||
|
||||
pub struct Composition {}
|
||||
|
||||
impl std::fmt::Debug for Composition {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Composition of members").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Composition {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Composition {
|
||||
///
|
||||
pub fn new() -> Composition {
|
||||
Composition {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberReferrerModel>, Error> {
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
mr.id = $1
|
||||
",
|
||||
MEMBER_QUERY
|
||||
);
|
||||
|
||||
match sql_query(query)
|
||||
.bind::<diesel::sql_types::Uuid, _>(id)
|
||||
.get_result::<models::MemberReferrerModel>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn selects(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
ids: Vec<uuid::Uuid>,
|
||||
) -> Result<Vec<models::MemberReferrerModel>, Error> {
|
||||
if ids.is_empty() {
|
||||
return Ok(vec![]);
|
||||
}
|
||||
|
||||
let mut query_where_id_in = String::new();
|
||||
|
||||
for id in ids {
|
||||
if !query_where_id_in.is_empty() {
|
||||
write!(&mut query_where_id_in, " , ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
write!(&mut query_where_id_in, " '{}' ", id)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
mr.id IN ({})
|
||||
",
|
||||
MEMBER_QUERY, query_where_id_in
|
||||
);
|
||||
|
||||
println!("query: {}", query);
|
||||
|
||||
match sql_query(query).get_results::<models::MemberReferrerModel>(conn) {
|
||||
Ok(m) => Ok(m),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(vec![]),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_by_username(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
username: &str,
|
||||
) -> Result<Option<models::MemberReferrerModel>, Error> {
|
||||
let query = format!(
|
||||
"
|
||||
{}
|
||||
WHERE
|
||||
_m.username = $1
|
||||
",
|
||||
MEMBER_QUERY
|
||||
);
|
||||
|
||||
match sql_query(query)
|
||||
.bind::<diesel::sql_types::Text, _>(username)
|
||||
.get_result::<models::MemberReferrerModel>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &repositories::member_referrer::models::FindAll,
|
||||
) -> Result<Vec<models::MemberReferrerModel>, Error> {
|
||||
let mut query = String::new();
|
||||
write!(&mut query, "{}", MEMBER_QUERY)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
|
||||
let mut query_where = String::new();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mr.member_id = '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = s.can_use {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mr.can_use = '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query_where, " AND ")
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
write!(&mut query_where, "mr.memo like '{}'", sp)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
}
|
||||
|
||||
if !query_where.is_empty() {
|
||||
write!(&mut query, " WHERE {}", query_where)
|
||||
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
|
||||
}
|
||||
|
||||
println!("query: {}", query);
|
||||
|
||||
match sql_query(query).get_results::<models::MemberReferrerModel>(conn) {
|
||||
Ok(m) => Ok(m),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(vec![]),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod composition;
|
||||
///
|
||||
pub mod models;
|
|
@ -1,54 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use crate::repositories::member::models::Member as _Member;
|
||||
use diesel::deserialize::QueryableByName;
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, PartialEq, Debug, Clone)]
|
||||
pub struct MemberReferrerModel {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member: _Member,
|
||||
///
|
||||
pub can_use: bool,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
impl QueryableByName<diesel::pg::Pg> for MemberReferrerModel {
|
||||
fn build<R: diesel::row::NamedRow<diesel::pg::Pg>>(row: &R) -> diesel::deserialize::Result<Self> {
|
||||
let member = _Member {
|
||||
id: row.get("_m_id")?,
|
||||
site_id: row.get("_m_site_id")?,
|
||||
member_class_id: row.get("_m_member_class_id")?,
|
||||
member_level_id: row.get("_m_member_level_id")?,
|
||||
username: row.get("_m_username")?,
|
||||
password: row.get("_m_password")?,
|
||||
nickname: row.get("_m_nickname")?,
|
||||
mobile_phone_number: row.get("_m_mobile_phone_number")?,
|
||||
state: row.get("_m_state")?,
|
||||
state_changed_at: row.get("_m_state_changed_at")?,
|
||||
parent_member_id: row.get("_m_parent_member_id")?,
|
||||
child_member_count: row.get("_m_child_member_count")?,
|
||||
last_signined_ip: row.get("_m_last_signined_ip")?,
|
||||
last_signined_at: row.get("_m_last_signined_at")?,
|
||||
created_at: row.get("_m_created_at")?,
|
||||
updated_at: row.get("_m_updated_at")?,
|
||||
deleted_at: row.get("_m_deleted_at")?,
|
||||
};
|
||||
|
||||
Ok(MemberReferrerModel {
|
||||
id: row.get("mr_id")?,
|
||||
member,
|
||||
can_use: row.get("mr_can_use")?,
|
||||
memo: row.get("mr_memo")?,
|
||||
created_at: row.get("mr_created_at")?,
|
||||
updated_at: row.get("mr_updated_at")?,
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
pub mod member;
|
||||
pub mod member_bank_deposit;
|
||||
pub mod member_bank_withdraw;
|
||||
pub mod member_referrer;
|
||||
pub mod site;
|
|
@ -1,62 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
use super::models;
|
||||
use crate::repositories;
|
||||
use diesel::{result::Error, sql_query, RunQueryDsl};
|
||||
|
||||
pub struct Composition {
|
||||
site_repository: repositories::site::repository::Repository,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Composition {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Composition of members").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Composition {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Composition {
|
||||
///
|
||||
pub fn new() -> Composition {
|
||||
Composition {
|
||||
site_repository: repositories::site::repository::Repository::new(),
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_by_url(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
url: Option<String>,
|
||||
site_id: uuid::Uuid,
|
||||
) -> Result<Option<repositories::site::models::Site>, Error> {
|
||||
let site_url = match url {
|
||||
Some(site_url) => site_url,
|
||||
None => {
|
||||
return Ok(None);
|
||||
}
|
||||
};
|
||||
let ms = match self.site_repository.select(conn, site_id)? {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
return Ok(None);
|
||||
}
|
||||
};
|
||||
|
||||
if ms.url.eq("*") {
|
||||
return Ok(Some(ms));
|
||||
}
|
||||
|
||||
if !ms.url.eq(&site_url) {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
Ok(Some(ms))
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod composition;
|
||||
///
|
||||
pub mod models;
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,164 +0,0 @@
|
|||
use super::super::super::repositories;
|
||||
use beteran_common_rust as bcr;
|
||||
use beteran_protobuf_rust as bpr;
|
||||
use diesel::{
|
||||
r2d2::{ConnectionManager, Pool},
|
||||
PgConnection,
|
||||
};
|
||||
use prost::Message;
|
||||
use std::str::FromStr;
|
||||
|
||||
pub struct EventHandler {
|
||||
connection_broker: nats::asynk::Connection,
|
||||
queue_broker: String,
|
||||
pool: Pool<ConnectionManager<PgConnection>>,
|
||||
member_repository: repositories::member::repository::Repository,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for EventHandler {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("EventHandler of members").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl EventHandler {
|
||||
///
|
||||
pub fn new(
|
||||
connection_broker: nats::asynk::Connection,
|
||||
queue_broker: String,
|
||||
pool: Pool<ConnectionManager<PgConnection>>,
|
||||
) -> EventHandler {
|
||||
EventHandler {
|
||||
connection_broker,
|
||||
queue_broker,
|
||||
pool,
|
||||
member_repository: repositories::member::repository::Repository::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn subscribe(&self) -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
|
||||
futures::try_join!(self.event_after_signin()).map(|_| ())
|
||||
}
|
||||
|
||||
async fn event_after_signin(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let s = self
|
||||
.connection_broker
|
||||
.queue_subscribe(
|
||||
bpr::ss::identity::EVENT_SUBJECT_AFTER_SIGNIN,
|
||||
self.queue_broker.as_str(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
while let Some(message) = s.next().await {
|
||||
if let Err(e) = async {
|
||||
let eve =
|
||||
bpr::ss::identity::AfterSigninEvent::decode(message.data.as_slice()).map_err(|e| {
|
||||
bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest {
|
||||
message: format!("invalid request: {}", e),
|
||||
})
|
||||
})?;
|
||||
|
||||
let client = match eve.client {
|
||||
Some(c) => c,
|
||||
None => {
|
||||
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||
bcr::error::rpc::InvalidParams {
|
||||
message: "invalid client information".to_string(),
|
||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||
location: "request".to_string(),
|
||||
param: "client".to_string(),
|
||||
value: "".to_string(),
|
||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||
message: "".to_string(),
|
||||
},
|
||||
},
|
||||
));
|
||||
}
|
||||
};
|
||||
let event = match eve.event {
|
||||
Some(r) => r,
|
||||
None => {
|
||||
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||
bcr::error::rpc::InvalidParams {
|
||||
message: "invalid event information".to_string(),
|
||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||
location: "event".to_string(),
|
||||
param: "event".to_string(),
|
||||
value: "".to_string(),
|
||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||
message: "".to_string(),
|
||||
},
|
||||
},
|
||||
));
|
||||
}
|
||||
};
|
||||
let member = match event.member {
|
||||
Some(c) => c,
|
||||
None => {
|
||||
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||
bcr::error::rpc::InvalidParams {
|
||||
message: "invalid client information".to_string(),
|
||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||
location: "request".to_string(),
|
||||
param: "client".to_string(),
|
||||
value: "".to_string(),
|
||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||
message: "".to_string(),
|
||||
},
|
||||
},
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
let id = uuid::Uuid::from_str(member.id.as_str()).map_err(|e| {
|
||||
bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams {
|
||||
message: "invalid member.id param".to_string(),
|
||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||
location: "request".to_string(),
|
||||
param: "member.id".to_string(),
|
||||
value: member.id.clone(),
|
||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||
message: e.to_string(),
|
||||
},
|
||||
})
|
||||
})?;
|
||||
|
||||
let conn = self.pool.get().map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})?;
|
||||
|
||||
let last_signined_at = chrono::Utc::now().timestamp();
|
||||
|
||||
self
|
||||
.member_repository
|
||||
.update_last_signined_ip(
|
||||
&conn,
|
||||
id,
|
||||
&repositories::member::models::ModifyMember4LastSignined {
|
||||
last_signined_ip: client.client_ip,
|
||||
last_signined_at,
|
||||
},
|
||||
)
|
||||
.map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})?;
|
||||
|
||||
Ok::<(), bcr::error::rpc::Error>(())
|
||||
}
|
||||
.await
|
||||
{
|
||||
println!("error: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
pub mod event;
|
|
@ -1,177 +0,0 @@
|
|||
use super::super::super::repositories;
|
||||
use beteran_common_rust as bcr;
|
||||
use beteran_protobuf_rust as bpr;
|
||||
use diesel::{
|
||||
r2d2::{ConnectionManager, Pool},
|
||||
PgConnection,
|
||||
};
|
||||
use prost::Message;
|
||||
use std::str::FromStr;
|
||||
|
||||
pub struct EventHandler {
|
||||
connection_broker: nats::asynk::Connection,
|
||||
queue_broker: String,
|
||||
pool: Pool<ConnectionManager<PgConnection>>,
|
||||
member_balance_repository: repositories::member_balance::repository::Repository,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for EventHandler {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("EventHandler of members").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl EventHandler {
|
||||
///
|
||||
pub fn new(
|
||||
connection_broker: nats::asynk::Connection,
|
||||
queue_broker: String,
|
||||
pool: Pool<ConnectionManager<PgConnection>>,
|
||||
) -> EventHandler {
|
||||
EventHandler {
|
||||
connection_broker,
|
||||
queue_broker,
|
||||
pool,
|
||||
member_balance_repository: repositories::member_balance::repository::Repository::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn subscribe(&self) -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
|
||||
futures::try_join!(self.event_after_update_member_balance()).map(|_| ())
|
||||
}
|
||||
|
||||
async fn event_after_update_member_balance(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let s = self
|
||||
.connection_broker
|
||||
.queue_subscribe(
|
||||
bpr::ss::member_balance::EVENT_SUBJECT_AFTER_UPDATE_MEMBER_BALANCE,
|
||||
self.queue_broker.as_str(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
while let Some(message) = s.next().await {
|
||||
if let Err(e) = async {
|
||||
let eve =
|
||||
bpr::ss::member_balance::AfterUpdateMemberBalanceEvent::decode(message.data.as_slice())
|
||||
.map_err(|e| {
|
||||
bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest {
|
||||
message: format!("invalid request: {}", e),
|
||||
})
|
||||
})?;
|
||||
|
||||
let client = match eve.client {
|
||||
Some(c) => c,
|
||||
None => {
|
||||
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||
bcr::error::rpc::InvalidParams {
|
||||
message: "invalid client information".to_string(),
|
||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||
location: "request".to_string(),
|
||||
param: "client".to_string(),
|
||||
value: "".to_string(),
|
||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||
message: "".to_string(),
|
||||
},
|
||||
},
|
||||
));
|
||||
}
|
||||
};
|
||||
let event = match eve.event {
|
||||
Some(r) => r,
|
||||
None => {
|
||||
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||
bcr::error::rpc::InvalidParams {
|
||||
message: "invalid event information".to_string(),
|
||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||
location: "event".to_string(),
|
||||
param: "event".to_string(),
|
||||
value: "".to_string(),
|
||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||
message: "".to_string(),
|
||||
},
|
||||
},
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
let member_id = uuid::Uuid::from_str(event.member_id.as_str()).map_err(|e| {
|
||||
bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams {
|
||||
message: "invalid member_id param".to_string(),
|
||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||
location: "request".to_string(),
|
||||
param: "member_id".to_string(),
|
||||
value: event.member_id.clone(),
|
||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||
message: e.to_string(),
|
||||
},
|
||||
})
|
||||
})?;
|
||||
|
||||
let conn = self.pool.get().map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})?;
|
||||
|
||||
let id = match self
|
||||
.member_balance_repository
|
||||
.select_by_member_id(&conn, member_id)
|
||||
.map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})? {
|
||||
Some(_mb) => _mb.id,
|
||||
None => {
|
||||
let _mb = self
|
||||
.member_balance_repository
|
||||
.insert(
|
||||
&conn,
|
||||
&repositories::member_balance::models::NewMemberBalance { member_id },
|
||||
)
|
||||
.map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})?;
|
||||
|
||||
_mb.id
|
||||
}
|
||||
};
|
||||
|
||||
self
|
||||
.member_balance_repository
|
||||
.update(
|
||||
&conn,
|
||||
id,
|
||||
&repositories::member_balance::models::ModifyMemberBalance {
|
||||
balance: event.balance,
|
||||
balance_bota: event.balance_bota,
|
||||
balance_sum: event.balance_sum,
|
||||
},
|
||||
)
|
||||
.map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})?;
|
||||
|
||||
Ok::<(), bcr::error::rpc::Error>(())
|
||||
}
|
||||
.await
|
||||
{
|
||||
println!("error: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
pub mod event;
|
|
@ -1,2 +0,0 @@
|
|||
pub mod member;
|
||||
pub mod member_balance;
|
162
src/main.rs
162
src/main.rs
|
@ -1,162 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
#[macro_use]
|
||||
extern crate diesel;
|
||||
#[macro_use]
|
||||
extern crate diesel_migrations;
|
||||
|
||||
use diesel::{
|
||||
r2d2::{ConnectionManager, Pool},
|
||||
PgConnection,
|
||||
};
|
||||
use std::env;
|
||||
|
||||
mod compositions;
|
||||
mod events;
|
||||
mod repositories;
|
||||
mod services;
|
||||
|
||||
diesel_migrations::embed_migrations!();
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let url_server_broker = match env::var_os("URL_BROKER") {
|
||||
Some(v) => v.into_string().unwrap(),
|
||||
None => "".to_string(),
|
||||
};
|
||||
let queue_server_broker = match env::var_os("QUEUE_BROKER") {
|
||||
Some(v) => v.into_string().unwrap(),
|
||||
None => "".to_string(),
|
||||
};
|
||||
|
||||
let url_db = match env::var_os("URL_DATABASE") {
|
||||
Some(v) => v.into_string().unwrap(),
|
||||
None => "".to_string(),
|
||||
};
|
||||
|
||||
let captcha_salt = match env::var_os("CAPTCHA_SALT") {
|
||||
Some(v) => v.into_string().unwrap(),
|
||||
None => "".to_string(),
|
||||
};
|
||||
let password_salt = match env::var_os("PASSWORD_SALT") {
|
||||
Some(v) => v.into_string().unwrap(),
|
||||
None => "".to_string(),
|
||||
};
|
||||
|
||||
let manager = ConnectionManager::<PgConnection>::new(url_db);
|
||||
let pool = Pool::builder()
|
||||
.max_size(4)
|
||||
.test_on_check_out(true)
|
||||
.build(manager)?;
|
||||
let conn = pool.get()?;
|
||||
|
||||
embedded_migrations::run(&conn)?;
|
||||
|
||||
let server_broker_opts = nats::asynk::Options::new();
|
||||
let connection_server_broker = server_broker_opts.connect(url_server_broker).await?;
|
||||
|
||||
let bank_service = services::bank::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let identity_service = services::identity::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
captcha_salt.clone(),
|
||||
password_salt.clone(),
|
||||
);
|
||||
let member_service = services::member::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
password_salt.clone(),
|
||||
);
|
||||
let member_bank_account_service = services::member_bank_account::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
password_salt.clone(),
|
||||
);
|
||||
let member_bank_deposit_service = services::member_bank_deposit::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_bank_withdraw_service = services::member_bank_withdraw::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_class_service = services::member_class::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_game_setting_service = services::member_game_setting::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_level_service = services::member_level::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_referrer_service = services::member_referrer::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_session_service = services::member_session::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_settlement_setting_service =
|
||||
services::member_settlement_setting::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let site_service = services::site::service::Service::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
|
||||
let member_event_handler = events::member::event::EventHandler::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
let member_balance_event_handler = events::member_balance::event::EventHandler::new(
|
||||
connection_server_broker.clone(),
|
||||
queue_server_broker.clone(),
|
||||
pool.clone(),
|
||||
);
|
||||
|
||||
println!("Server service [beteran-server-service] is started");
|
||||
|
||||
futures::try_join!(
|
||||
bank_service.subscribe(),
|
||||
identity_service.subscribe(),
|
||||
member_service.subscribe(),
|
||||
member_bank_account_service.subscribe(),
|
||||
member_bank_deposit_service.subscribe(),
|
||||
member_bank_withdraw_service.subscribe(),
|
||||
member_class_service.subscribe(),
|
||||
member_game_setting_service.subscribe(),
|
||||
member_level_service.subscribe(),
|
||||
member_session_service.subscribe(),
|
||||
member_referrer_service.subscribe(),
|
||||
member_settlement_setting_service.subscribe(),
|
||||
site_service.subscribe(),
|
||||
member_event_handler.subscribe(),
|
||||
member_balance_event_handler.subscribe(),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod models;
|
||||
///
|
||||
pub mod repository;
|
||||
///
|
||||
pub mod schema;
|
|
@ -1,78 +0,0 @@
|
|||
use super::schema::banks;
|
||||
use beteran_common_rust as bcr;
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, PartialOrd, Debug, Clone)]
|
||||
#[table_name = "banks"]
|
||||
pub struct Bank {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub sort_order: i32,
|
||||
///
|
||||
pub show: bool,
|
||||
///
|
||||
pub can_use: bool,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "banks"]
|
||||
pub struct NewBank {
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub sort_order: i32,
|
||||
///
|
||||
pub show: bool,
|
||||
///
|
||||
pub can_use: bool,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "banks"]
|
||||
pub struct ModifyBank {
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub sort_order: i32,
|
||||
///
|
||||
pub show: bool,
|
||||
///
|
||||
pub can_use: bool,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAllSearch {
|
||||
///
|
||||
pub name_like: Option<String>,
|
||||
///
|
||||
pub show: Option<bool>,
|
||||
///
|
||||
pub can_use: Option<bool>,
|
||||
///
|
||||
pub memo_like: Option<String>,
|
||||
}
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
pub search: Option<FindAllSearch>,
|
||||
///
|
||||
pub pagination: Option<bcr::pagination::Pagination>,
|
||||
///
|
||||
pub sorts: Option<Vec<bcr::pagination::Sort>>,
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use super::{models, schema::banks};
|
||||
use beteran_common_rust as bcr;
|
||||
use diesel::prelude::*;
|
||||
use diesel::result::Error;
|
||||
|
||||
///
|
||||
pub struct Repository {}
|
||||
|
||||
impl std::fmt::Debug for Repository {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Repository of banks").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Repository {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Repository {
|
||||
///
|
||||
pub fn new() -> Repository {
|
||||
Repository {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_member: &models::NewBank,
|
||||
) -> Result<models::Bank, Error> {
|
||||
let inserted = diesel::insert_into(banks::table)
|
||||
.values(new_member)
|
||||
.get_result::<models::Bank>(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::Bank>, Error> {
|
||||
match banks::table.find(id).first::<models::Bank>(conn) {
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<i64, Error> {
|
||||
let mut q = banks::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(banks::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.show {
|
||||
q = q.filter(banks::dsl::show.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.can_use {
|
||||
q = q.filter(banks::dsl::can_use.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(banks::dsl::memo.like(sp));
|
||||
}
|
||||
}
|
||||
|
||||
q.count().get_result(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<Vec<models::Bank>, Error> {
|
||||
let mut q = banks::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(banks::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.show {
|
||||
q = q.filter(banks::dsl::show.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.can_use {
|
||||
q = q.filter(banks::dsl::can_use.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(banks::dsl::memo.like(sp));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(p) = &find_all.pagination {
|
||||
let page = p.page.unwrap_or(1);
|
||||
|
||||
if let Some(page_size) = p.page_size {
|
||||
q = q.offset(((page - 1) * page_size) as i64);
|
||||
q = q.limit(page_size as i64);
|
||||
}
|
||||
}
|
||||
if let Some(orderbys) = &find_all.sorts {
|
||||
for s in orderbys {
|
||||
match s {
|
||||
bcr::pagination::Sort::ASC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(banks::name.asc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(banks::created_at.asc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(banks::updated_at.asc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
bcr::pagination::Sort::DESC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(banks::name.desc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(banks::created_at.desc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(banks::updated_at.desc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
q.load::<models::Bank>(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyBank,
|
||||
) -> Result<u64, Error> {
|
||||
use banks::dsl;
|
||||
|
||||
diesel::update(dsl::banks.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn delete(&self, conn: &diesel::PgConnection, id: uuid::Uuid) -> Result<u64, Error> {
|
||||
use banks::dsl;
|
||||
|
||||
diesel::delete(banks::table.filter(dsl::id.eq(id)))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
table! {
|
||||
///
|
||||
banks(id) {
|
||||
///
|
||||
id -> Uuid,
|
||||
///
|
||||
name -> Text,
|
||||
///
|
||||
sort_order -> Integer,
|
||||
///
|
||||
show -> Bool,
|
||||
///
|
||||
can_use -> Bool,
|
||||
///
|
||||
memo -> Nullable<Text>,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod models;
|
||||
///
|
||||
pub mod repository;
|
||||
///
|
||||
pub mod schema;
|
|
@ -1,156 +0,0 @@
|
|||
use super::schema::{members, MemberState};
|
||||
use beteran_common_rust as bcr;
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, PartialEq, PartialOrd, Debug, Clone, Identifiable, Queryable)]
|
||||
#[table_name = "members"]
|
||||
pub struct Member {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub site_id: uuid::Uuid,
|
||||
///
|
||||
pub member_class_id: uuid::Uuid,
|
||||
///
|
||||
pub member_level_id: uuid::Uuid,
|
||||
///
|
||||
pub username: String,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub nickname: String,
|
||||
///
|
||||
pub mobile_phone_number: Option<String>,
|
||||
///
|
||||
pub state: MemberState,
|
||||
///
|
||||
pub state_changed_at: Option<i64>,
|
||||
///
|
||||
pub parent_member_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub child_member_count: i64,
|
||||
///
|
||||
pub last_signined_ip: Option<String>,
|
||||
///
|
||||
pub last_signined_at: Option<i64>,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
///
|
||||
pub deleted_at: Option<i64>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "members"]
|
||||
pub struct NewMember {
|
||||
///
|
||||
pub site_id: uuid::Uuid,
|
||||
///
|
||||
pub member_class_id: uuid::Uuid,
|
||||
///
|
||||
pub member_level_id: uuid::Uuid,
|
||||
///
|
||||
pub parent_member_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub username: String,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub state: MemberState,
|
||||
///
|
||||
pub nickname: String,
|
||||
///
|
||||
pub mobile_phone_number: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "members"]
|
||||
pub struct ModifyMember {
|
||||
///
|
||||
pub site_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub member_level_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub mobile_phone_number: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "members"]
|
||||
pub struct ModifyMemberForPassword {
|
||||
///
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "members"]
|
||||
pub struct ModifyMemberForState {
|
||||
///
|
||||
pub state: MemberState,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "members"]
|
||||
pub struct ModifyMember4LastSignined {
|
||||
///
|
||||
pub last_signined_ip: String,
|
||||
//
|
||||
pub last_signined_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "members"]
|
||||
pub struct ModifyMember4DeletedAt {
|
||||
///
|
||||
pub deleted_at: Option<i64>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAllSearch {
|
||||
///
|
||||
pub site_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub member_class_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub member_level_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub parent_member_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub username: Option<String>,
|
||||
///
|
||||
pub usernames: Vec<String>,
|
||||
///
|
||||
pub username_like: Option<String>,
|
||||
///
|
||||
pub nickname: Option<String>,
|
||||
///
|
||||
pub nicknames: Vec<String>,
|
||||
///
|
||||
pub nickname_like: Option<String>,
|
||||
///
|
||||
pub mobile_phone_number_like: Option<String>,
|
||||
///
|
||||
pub last_signined_ip: Option<String>,
|
||||
///
|
||||
pub state: Option<MemberState>,
|
||||
///
|
||||
pub deleted_at: Option<bool>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
///
|
||||
pub search: Option<FindAllSearch>,
|
||||
///
|
||||
pub pagination: Option<bcr::pagination::Pagination>,
|
||||
///
|
||||
pub sorts: Option<Vec<bcr::pagination::Sort>>,
|
||||
}
|
|
@ -1,365 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
use super::{models, schema::members};
|
||||
use beteran_common_rust as bcr;
|
||||
use diesel::prelude::*;
|
||||
use diesel::result::Error;
|
||||
|
||||
///
|
||||
pub struct Repository {}
|
||||
|
||||
impl std::fmt::Debug for Repository {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Repository of members").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Repository {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Repository {
|
||||
///
|
||||
pub fn new() -> Repository {
|
||||
Repository {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_member: &models::NewMember,
|
||||
) -> Result<models::Member, Error> {
|
||||
let inserted = diesel::insert_into(members::table)
|
||||
.values(new_member)
|
||||
.get_result::<models::Member>(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::Member>, Error> {
|
||||
match members::table.find(id).first::<models::Member>(conn) {
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_by_username(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
username: &str,
|
||||
) -> Result<Option<models::Member>, Error> {
|
||||
use members::dsl;
|
||||
|
||||
match members::table
|
||||
.filter(dsl::username.eq(username))
|
||||
.first::<models::Member>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_by_nickname(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
nickname: &str,
|
||||
) -> Result<Option<models::Member>, Error> {
|
||||
use members::dsl;
|
||||
|
||||
match members::table
|
||||
.filter(dsl::nickname.eq(nickname))
|
||||
.first::<models::Member>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<i64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
let mut q = members::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.site_id {
|
||||
q = q.filter(dsl::site_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.member_class_id {
|
||||
q = q.filter(dsl::member_class_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.member_level_id {
|
||||
q = q.filter(dsl::member_level_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.username_like {
|
||||
q = q.filter(dsl::username.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.nickname_like {
|
||||
q = q.filter(dsl::nickname.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.mobile_phone_number_like {
|
||||
q = q.filter(dsl::mobile_phone_number.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.last_signined_ip {
|
||||
q = q.filter(dsl::last_signined_ip.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
q = q.filter(dsl::state.eq(sp));
|
||||
}
|
||||
if s.deleted_at.is_some() {
|
||||
q = q.filter(dsl::deleted_at.is_not_null());
|
||||
} else {
|
||||
q = q.filter(dsl::deleted_at.is_null());
|
||||
}
|
||||
}
|
||||
|
||||
q.count().get_result(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<Vec<models::Member>, Error> {
|
||||
use members::dsl;
|
||||
|
||||
let mut q = members::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.site_id {
|
||||
q = q.filter(dsl::site_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.member_class_id {
|
||||
q = q.filter(dsl::member_class_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.member_level_id {
|
||||
q = q.filter(dsl::member_level_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.username_like {
|
||||
q = q.filter(dsl::username.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.nickname_like {
|
||||
q = q.filter(dsl::nickname.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.mobile_phone_number_like {
|
||||
q = q.filter(dsl::mobile_phone_number.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.last_signined_ip {
|
||||
q = q.filter(dsl::last_signined_ip.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
q = q.filter(dsl::state.eq(sp));
|
||||
}
|
||||
if s.deleted_at.is_some() {
|
||||
q = q.filter(dsl::deleted_at.is_not_null());
|
||||
} else {
|
||||
q = q.filter(dsl::deleted_at.is_null());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(p) = &find_all.pagination {
|
||||
let page = p.page.unwrap_or(1);
|
||||
|
||||
if let Some(page_size) = p.page_size {
|
||||
q = q.offset(((page - 1) * page_size) as i64);
|
||||
q = q.limit(page_size as i64);
|
||||
}
|
||||
}
|
||||
if let Some(orderbys) = &find_all.sorts {
|
||||
for s in orderbys {
|
||||
match s {
|
||||
bcr::pagination::Sort::ASC(property) => match property.as_str() {
|
||||
"username" => {
|
||||
q = q.order_by(dsl::username.asc());
|
||||
}
|
||||
"nickname" => {
|
||||
q = q.order_by(dsl::nickname.asc());
|
||||
}
|
||||
"mobile_phone_number" => {
|
||||
q = q.order_by(dsl::mobile_phone_number.asc());
|
||||
}
|
||||
"last_signined_ip" => {
|
||||
q = q.order_by(dsl::last_signined_ip.asc());
|
||||
}
|
||||
"state" => {
|
||||
q = q.order_by(dsl::state.asc());
|
||||
}
|
||||
"state_changed_at" => {
|
||||
q = q.order_by(dsl::state_changed_at.asc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(dsl::created_at.asc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(dsl::updated_at.asc());
|
||||
}
|
||||
"deleted_at" => {
|
||||
q = q.order_by(dsl::deleted_at.asc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
bcr::pagination::Sort::DESC(property) => match property.as_str() {
|
||||
"username" => {
|
||||
q = q.order_by(dsl::username.desc());
|
||||
}
|
||||
"nickname" => {
|
||||
q = q.order_by(dsl::nickname.desc());
|
||||
}
|
||||
"mobile_phone_number" => {
|
||||
q = q.order_by(dsl::mobile_phone_number.desc());
|
||||
}
|
||||
"last_signined_ip" => {
|
||||
q = q.order_by(dsl::last_signined_ip.desc());
|
||||
}
|
||||
"state" => {
|
||||
q = q.order_by(dsl::state.desc());
|
||||
}
|
||||
"state_changed_at" => {
|
||||
q = q.order_by(dsl::state_changed_at.desc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(dsl::created_at.desc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(dsl::updated_at.desc());
|
||||
}
|
||||
"deleted_at" => {
|
||||
q = q.order_by(dsl::deleted_at.desc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
q.load::<models::Member>(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMember,
|
||||
) -> Result<u64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
diesel::update(dsl::members.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update_password(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberForPassword,
|
||||
) -> Result<u64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
diesel::update(dsl::members.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update_state(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberForState,
|
||||
) -> Result<u64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
diesel::update(dsl::members.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn increase_child_member_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<u64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
diesel::update(dsl::members.filter(dsl::id.eq(id)))
|
||||
.set(dsl::child_member_count.eq(dsl::child_member_count + 1))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn decrease_child_member_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<u64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
diesel::update(dsl::members.filter(dsl::id.eq(id)))
|
||||
.set(dsl::child_member_count.eq(dsl::child_member_count - 1))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update_last_signined_ip(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMember4LastSignined,
|
||||
) -> Result<u64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
diesel::update(dsl::members.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update_deleted_at(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMember4DeletedAt,
|
||||
) -> Result<u64, Error> {
|
||||
use members::dsl;
|
||||
|
||||
diesel::update(dsl::members.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, Debug, Clone, Copy, PartialEq, PartialOrd, diesel_derive_enum::DbEnum)]
|
||||
pub enum MemberState {
|
||||
Normal = 1,
|
||||
Pending,
|
||||
Withdrawal,
|
||||
Dormancy,
|
||||
Blacklist,
|
||||
Suspended,
|
||||
}
|
||||
|
||||
table! {
|
||||
use diesel::sql_types::{Uuid, Text, BigInt, Nullable};
|
||||
use super::MemberStateMapping;
|
||||
|
||||
///
|
||||
members(id) {
|
||||
///
|
||||
id -> Uuid,
|
||||
///
|
||||
site_id -> Uuid,
|
||||
///
|
||||
member_class_id -> Uuid,
|
||||
///
|
||||
member_level_id -> Uuid,
|
||||
///
|
||||
username -> Text,
|
||||
///
|
||||
password -> Text,
|
||||
///
|
||||
nickname -> Text,
|
||||
///
|
||||
mobile_phone_number -> Nullable<Text>,
|
||||
///
|
||||
state -> MemberStateMapping,
|
||||
///
|
||||
state_changed_at -> Nullable<BigInt>,
|
||||
///
|
||||
parent_member_id -> Nullable<Uuid>,
|
||||
///
|
||||
child_member_count -> BigInt,
|
||||
///
|
||||
last_signined_ip -> Nullable<Text>,
|
||||
///
|
||||
last_signined_at -> Nullable<BigInt>,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
///
|
||||
deleted_at -> Nullable<BigInt>,
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod models;
|
||||
///
|
||||
pub mod repository;
|
||||
///
|
||||
pub mod schema;
|
|
@ -1,60 +0,0 @@
|
|||
use super::schema::member_balances;
|
||||
use beteran_common_rust as bcr;
|
||||
|
||||
///
|
||||
#[derive(Identifiable, Queryable, PartialEq, PartialOrd, Debug, Clone)]
|
||||
#[table_name = "member_balances"]
|
||||
pub struct MemberBalance {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub balance: f64,
|
||||
///
|
||||
pub balance_bota: f64,
|
||||
///
|
||||
pub balance_sum: f64,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "member_balances"]
|
||||
pub struct NewMemberBalance {
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_balances"]
|
||||
pub struct ModifyMemberBalance {
|
||||
///
|
||||
pub balance: f64,
|
||||
///
|
||||
pub balance_bota: f64,
|
||||
///
|
||||
pub balance_sum: f64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAllSearch {
|
||||
///
|
||||
pub member_id: Option<uuid::Uuid>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
///
|
||||
pub search: Option<FindAllSearch>,
|
||||
///
|
||||
pub pagination: Option<bcr::pagination::Pagination>,
|
||||
///
|
||||
pub sorts: Option<Vec<bcr::pagination::Sort>>,
|
||||
}
|
|
@ -1,189 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use super::{models, schema::member_balances};
|
||||
use beteran_common_rust as bcr;
|
||||
use diesel::prelude::*;
|
||||
use diesel::result::Error;
|
||||
|
||||
///
|
||||
pub struct Repository {}
|
||||
|
||||
impl std::fmt::Debug for Repository {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Repository of member_balances").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Repository {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Repository {
|
||||
///
|
||||
pub fn new() -> Repository {
|
||||
Repository {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_resource: &models::NewMemberBalance,
|
||||
) -> Result<models::MemberBalance, Error> {
|
||||
let inserted = diesel::insert_into(member_balances::table)
|
||||
.values(new_resource)
|
||||
.get_result::<models::MemberBalance>(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBalance>, Error> {
|
||||
match member_balances::table
|
||||
.find(id as uuid::Uuid)
|
||||
.first::<models::MemberBalance>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_by_member_id(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
member_id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBalance>, Error> {
|
||||
use member_balances::dsl;
|
||||
|
||||
match member_balances::table
|
||||
.filter(dsl::member_id.eq(member_id))
|
||||
.first::<models::MemberBalance>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<i64, Error> {
|
||||
let mut q = member_balances::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_balances::dsl::member_id.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
q.count().get_result(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<Vec<models::MemberBalance>, Error> {
|
||||
let mut q = member_balances::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_balances::dsl::member_id.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(p) = &find_all.pagination {
|
||||
let page = p.page.unwrap_or(1);
|
||||
|
||||
if let Some(page_size) = p.page_size {
|
||||
q = q.offset(((page - 1) * page_size) as i64);
|
||||
q = q.limit(page_size as i64);
|
||||
}
|
||||
}
|
||||
if let Some(orderbys) = &find_all.sorts {
|
||||
for s in orderbys {
|
||||
match s {
|
||||
bcr::pagination::Sort::ASC(property) => match property.as_str() {
|
||||
"balance" => {
|
||||
q = q.order_by(member_balances::balance.asc());
|
||||
}
|
||||
"balance_bota" => {
|
||||
q = q.order_by(member_balances::balance_bota.asc());
|
||||
}
|
||||
"balance_sum" => {
|
||||
q = q.order_by(member_balances::balance_sum.asc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_balances::created_at.asc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_balances::updated_at.asc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
bcr::pagination::Sort::DESC(property) => match property.as_str() {
|
||||
"balance" => {
|
||||
q = q.order_by(member_balances::balance.desc());
|
||||
}
|
||||
"balance_bota" => {
|
||||
q = q.order_by(member_balances::balance_bota.desc());
|
||||
}
|
||||
"balance_sum" => {
|
||||
q = q.order_by(member_balances::balance_sum.desc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_balances::created_at.desc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_balances::updated_at.desc());
|
||||
}
|
||||
|
||||
_ => {}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
q.load::<models::MemberBalance>(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberBalance,
|
||||
) -> Result<u64, Error> {
|
||||
use member_balances::dsl;
|
||||
|
||||
diesel::update(dsl::member_balances.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn delete(&self, conn: &diesel::PgConnection, id: uuid::Uuid) -> Result<u64, Error> {
|
||||
use member_balances::dsl;
|
||||
|
||||
diesel::delete(member_balances::table.filter(dsl::id.eq(id)))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
table! {
|
||||
///
|
||||
member_balances(id) {
|
||||
///
|
||||
id -> Uuid,
|
||||
///
|
||||
member_id -> Uuid,
|
||||
///
|
||||
balance -> Double,
|
||||
///
|
||||
balance_bota -> Double,
|
||||
///
|
||||
balance_sum -> Double,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod models;
|
||||
///
|
||||
pub mod repository;
|
||||
///
|
||||
pub mod schema;
|
|
@ -1,92 +0,0 @@
|
|||
use super::schema::member_bank_accounts;
|
||||
use beteran_common_rust as bcr;
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, Debug, Clone)]
|
||||
#[table_name = "member_bank_accounts"]
|
||||
pub struct MemberBankAccount {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub bank_id: uuid::Uuid,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub exchange_password: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "member_bank_accounts"]
|
||||
pub struct NewMemberBankAccount {
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub bank_id: uuid::Uuid,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub exchange_password: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_bank_accounts"]
|
||||
pub struct ModifyMemberBankAccount {
|
||||
///
|
||||
pub bank_id: uuid::Uuid,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_bank_accounts"]
|
||||
pub struct ModifyMemberBankAccountForExchangePassword {
|
||||
///
|
||||
pub exchange_password: String,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAllSearch {
|
||||
///
|
||||
pub member_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub bank_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub name_like: Option<String>,
|
||||
///
|
||||
pub account_number_like: Option<String>,
|
||||
///
|
||||
pub memo_like: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
///
|
||||
pub search: Option<FindAllSearch>,
|
||||
///
|
||||
pub pagination: Option<bcr::pagination::Pagination>,
|
||||
///
|
||||
pub sorts: Option<Vec<bcr::pagination::Sort>>,
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use super::{models, schema::member_bank_accounts};
|
||||
use beteran_common_rust as bcr;
|
||||
use diesel::prelude::*;
|
||||
use diesel::result::Error;
|
||||
|
||||
///
|
||||
pub struct Repository {}
|
||||
|
||||
impl std::fmt::Debug for Repository {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Repository of member_bank_accounts")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Repository {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Repository {
|
||||
///
|
||||
pub fn new() -> Repository {
|
||||
Repository {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_resource: &models::NewMemberBankAccount,
|
||||
) -> Result<models::MemberBankAccount, Error> {
|
||||
let inserted = diesel::insert_into(member_bank_accounts::table)
|
||||
.values(new_resource)
|
||||
.get_result::<models::MemberBankAccount>(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBankAccount>, Error> {
|
||||
match member_bank_accounts::table
|
||||
.find(id as uuid::Uuid)
|
||||
.first::<models::MemberBankAccount>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_by_member_id(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
member_id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBankAccount>, Error> {
|
||||
use member_bank_accounts::dsl;
|
||||
|
||||
match member_bank_accounts::table
|
||||
.filter(dsl::member_id.eq(member_id))
|
||||
.first::<models::MemberBankAccount>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<i64, Error> {
|
||||
let mut q = member_bank_accounts::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_bank_accounts::dsl::member_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.bank_id {
|
||||
q = q.filter(member_bank_accounts::dsl::bank_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_bank_accounts::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.account_number_like {
|
||||
q = q.filter(member_bank_accounts::dsl::account_number.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(member_bank_accounts::dsl::memo.like(sp));
|
||||
}
|
||||
}
|
||||
|
||||
q.count().get_result(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<Vec<models::MemberBankAccount>, Error> {
|
||||
let mut q = member_bank_accounts::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_bank_accounts::dsl::member_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = s.bank_id {
|
||||
q = q.filter(member_bank_accounts::dsl::bank_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_bank_accounts::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.account_number_like {
|
||||
q = q.filter(member_bank_accounts::dsl::account_number.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(member_bank_accounts::dsl::memo.like(sp));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(p) = &find_all.pagination {
|
||||
let page = p.page.unwrap_or(1);
|
||||
|
||||
if let Some(page_size) = p.page_size {
|
||||
q = q.offset(((page - 1) * page_size) as i64);
|
||||
q = q.limit(page_size as i64);
|
||||
}
|
||||
}
|
||||
if let Some(orderbys) = &find_all.sorts {
|
||||
for s in orderbys {
|
||||
match s {
|
||||
bcr::pagination::Sort::ASC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(member_bank_accounts::name.asc());
|
||||
}
|
||||
"account_number" => {
|
||||
q = q.order_by(member_bank_accounts::account_number.asc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_bank_accounts::created_at.asc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_bank_accounts::updated_at.asc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
bcr::pagination::Sort::DESC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(member_bank_accounts::name.desc());
|
||||
}
|
||||
"account_number" => {
|
||||
q = q.order_by(member_bank_accounts::account_number.desc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_bank_accounts::created_at.desc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_bank_accounts::updated_at.desc());
|
||||
}
|
||||
|
||||
_ => {}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
q.load::<models::MemberBankAccount>(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberBankAccount,
|
||||
) -> Result<u64, Error> {
|
||||
use member_bank_accounts::dsl;
|
||||
|
||||
diesel::update(dsl::member_bank_accounts.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update_exchange_password(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberBankAccountForExchangePassword,
|
||||
) -> Result<u64, Error> {
|
||||
use member_bank_accounts::dsl;
|
||||
|
||||
diesel::update(dsl::member_bank_accounts.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn delete(&self, conn: &diesel::PgConnection, id: uuid::Uuid) -> Result<u64, Error> {
|
||||
use member_bank_accounts::dsl;
|
||||
|
||||
diesel::delete(member_bank_accounts::table.filter(dsl::id.eq(id)))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
table! {
|
||||
///
|
||||
member_bank_accounts(id) {
|
||||
///
|
||||
id -> Uuid,
|
||||
///
|
||||
member_id -> Uuid,
|
||||
///
|
||||
bank_id -> Uuid,
|
||||
///
|
||||
name -> Text,
|
||||
///
|
||||
account_number -> Text,
|
||||
///
|
||||
exchange_password -> Text,
|
||||
///
|
||||
memo -> Nullable<Text>,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod models;
|
||||
///
|
||||
pub mod repository;
|
||||
///
|
||||
pub mod schema;
|
|
@ -1,86 +0,0 @@
|
|||
use super::schema::{member_bank_deposits, MemberBankDepositState};
|
||||
use beteran_common_rust as bcr;
|
||||
|
||||
///
|
||||
#[derive(Identifiable, Queryable, PartialEq, Debug, Clone)]
|
||||
#[table_name = "member_bank_deposits"]
|
||||
pub struct MemberBankDeposit {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub state: MemberBankDepositState,
|
||||
///
|
||||
pub state_changed_at: i64,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "member_bank_deposits"]
|
||||
pub struct NewMemberBankDeposit {
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_bank_deposits"]
|
||||
pub struct ModifyMemberBankDeposit {
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_bank_deposits"]
|
||||
pub struct ModifyMemberBankDepositForState {
|
||||
///
|
||||
pub state: MemberBankDepositState,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAllSearch {
|
||||
///
|
||||
pub member_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub name_like: Option<String>,
|
||||
///
|
||||
pub amount: Option<f64>,
|
||||
///
|
||||
pub memo_like: Option<String>,
|
||||
///
|
||||
pub state: Option<MemberBankDepositState>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
///
|
||||
pub search: Option<FindAllSearch>,
|
||||
///
|
||||
pub pagination: Option<bcr::pagination::Pagination>,
|
||||
///
|
||||
pub sorts: Option<Vec<bcr::pagination::Sort>>,
|
||||
}
|
|
@ -1,212 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use super::{models, schema::member_bank_deposits};
|
||||
use beteran_common_rust as bcr;
|
||||
use diesel::prelude::*;
|
||||
use diesel::result::Error;
|
||||
|
||||
///
|
||||
pub struct Repository {}
|
||||
|
||||
impl std::fmt::Debug for Repository {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Repository of member_bank_deposits")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Repository {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Repository {
|
||||
///
|
||||
pub fn new() -> Repository {
|
||||
Repository {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_resource: &models::NewMemberBankDeposit,
|
||||
) -> Result<uuid::Uuid, Error> {
|
||||
use member_bank_deposits::dsl;
|
||||
|
||||
let inserted = diesel::insert_into(member_bank_deposits::table)
|
||||
.values(new_resource)
|
||||
.returning(dsl::id)
|
||||
.get_result(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBankDeposit>, Error> {
|
||||
match member_bank_deposits::table
|
||||
.find(id as uuid::Uuid)
|
||||
.first::<models::MemberBankDeposit>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<i64, Error> {
|
||||
let mut q = member_bank_deposits::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_bank_deposits::dsl::member_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_bank_deposits::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.amount {
|
||||
q = q.filter(member_bank_deposits::dsl::amount.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(member_bank_deposits::dsl::memo.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
q = q.filter(member_bank_deposits::dsl::state.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
q.count().get_result(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<Vec<models::MemberBankDeposit>, Error> {
|
||||
let mut q = member_bank_deposits::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_bank_deposits::dsl::member_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_bank_deposits::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.amount {
|
||||
q = q.filter(member_bank_deposits::dsl::amount.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(member_bank_deposits::dsl::memo.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
q = q.filter(member_bank_deposits::dsl::state.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(p) = &find_all.pagination {
|
||||
let page = p.page.unwrap_or(1);
|
||||
|
||||
if let Some(page_size) = p.page_size {
|
||||
q = q.offset(((page - 1) * page_size) as i64);
|
||||
q = q.limit(page_size as i64);
|
||||
}
|
||||
}
|
||||
if let Some(orderbys) = &find_all.sorts {
|
||||
for s in orderbys {
|
||||
match s {
|
||||
bcr::pagination::Sort::ASC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(member_bank_deposits::name.asc());
|
||||
}
|
||||
"amount" => {
|
||||
q = q.order_by(member_bank_deposits::amount.asc());
|
||||
}
|
||||
"state" => {
|
||||
q = q.order_by(member_bank_deposits::state.asc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_bank_deposits::created_at.asc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_bank_deposits::updated_at.asc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
bcr::pagination::Sort::DESC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(member_bank_deposits::name.desc());
|
||||
}
|
||||
"amount" => {
|
||||
q = q.order_by(member_bank_deposits::amount.desc());
|
||||
}
|
||||
"state" => {
|
||||
q = q.order_by(member_bank_deposits::state.desc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_bank_deposits::created_at.desc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_bank_deposits::updated_at.desc());
|
||||
}
|
||||
|
||||
_ => {}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
q.load::<models::MemberBankDeposit>(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberBankDeposit,
|
||||
) -> Result<u64, Error> {
|
||||
use member_bank_deposits::dsl;
|
||||
|
||||
diesel::update(dsl::member_bank_deposits.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update_state(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberBankDepositForState,
|
||||
) -> Result<u64, Error> {
|
||||
use member_bank_deposits::dsl;
|
||||
|
||||
diesel::update(dsl::member_bank_deposits.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn delete(&self, conn: &diesel::PgConnection, id: uuid::Uuid) -> Result<u64, Error> {
|
||||
use member_bank_deposits::dsl;
|
||||
|
||||
diesel::delete(member_bank_deposits::table.filter(dsl::id.eq(id)))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, Debug, Clone, Copy, PartialEq, diesel_derive_enum::DbEnum)]
|
||||
pub enum MemberBankDepositState {
|
||||
Application = 1,
|
||||
Pending,
|
||||
Complete,
|
||||
}
|
||||
|
||||
table! {
|
||||
use diesel::sql_types::{Uuid, Text, BigInt, Nullable, Double};
|
||||
use super::MemberBankDepositStateMapping;
|
||||
|
||||
///
|
||||
member_bank_deposits(id) {
|
||||
///
|
||||
id -> Uuid,
|
||||
///
|
||||
member_id -> Uuid,
|
||||
///
|
||||
name -> Text,
|
||||
///
|
||||
amount -> Double,
|
||||
///
|
||||
memo -> Nullable<Text>,
|
||||
///
|
||||
state -> MemberBankDepositStateMapping,
|
||||
///
|
||||
state_changed_at -> BigInt,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod models;
|
||||
///
|
||||
pub mod repository;
|
||||
///
|
||||
pub mod schema;
|
|
@ -1,108 +0,0 @@
|
|||
use super::schema::{member_bank_withdraws, MemberBankWithdrawState};
|
||||
use beteran_common_rust as bcr;
|
||||
|
||||
///
|
||||
#[derive(Identifiable, Queryable, PartialEq, Debug, Clone)]
|
||||
#[table_name = "member_bank_withdraws"]
|
||||
pub struct MemberBankWithdraw {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub bank_name: String,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
///
|
||||
pub state: MemberBankWithdrawState,
|
||||
///
|
||||
pub state_changed_at: i64,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "member_bank_withdraws"]
|
||||
pub struct NewMemberBankWithdraw {
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
///
|
||||
pub bank_name: String,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_bank_withdraws"]
|
||||
pub struct ModifyMemberBankWithdraw {
|
||||
///
|
||||
pub bank_name: String,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub account_number: String,
|
||||
///
|
||||
pub amount: f64,
|
||||
///
|
||||
pub password: String,
|
||||
///
|
||||
pub memo: Option<String>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_bank_withdraws"]
|
||||
pub struct ModifyMemberBankWithdrawForState {
|
||||
///
|
||||
pub state: MemberBankWithdrawState,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAllSearch {
|
||||
///
|
||||
pub member_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub bank_name_like: Option<String>,
|
||||
///
|
||||
pub name_like: Option<String>,
|
||||
///
|
||||
pub account_number_like: Option<String>,
|
||||
///
|
||||
pub amount: Option<f64>,
|
||||
///
|
||||
pub memo_like: Option<String>,
|
||||
///
|
||||
pub state: Option<MemberBankWithdrawState>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
///
|
||||
pub search: Option<FindAllSearch>,
|
||||
///
|
||||
pub pagination: Option<bcr::pagination::Pagination>,
|
||||
///
|
||||
pub sorts: Option<Vec<bcr::pagination::Sort>>,
|
||||
}
|
|
@ -1,242 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use super::{models, schema::member_bank_withdraws};
|
||||
use beteran_common_rust as bcr;
|
||||
use diesel::prelude::*;
|
||||
use diesel::result::Error;
|
||||
|
||||
///
|
||||
pub struct Repository {}
|
||||
|
||||
impl std::fmt::Debug for Repository {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Repository of member_bank_withdraws")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Repository {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Repository {
|
||||
///
|
||||
pub fn new() -> Repository {
|
||||
Repository {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_resource: &models::NewMemberBankWithdraw,
|
||||
) -> Result<uuid::Uuid, Error> {
|
||||
use member_bank_withdraws::dsl;
|
||||
|
||||
let inserted = diesel::insert_into(member_bank_withdraws::table)
|
||||
.values(new_resource)
|
||||
.returning(dsl::id)
|
||||
.get_result(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberBankWithdraw>, Error> {
|
||||
match member_bank_withdraws::table
|
||||
.find(id as uuid::Uuid)
|
||||
.first::<models::MemberBankWithdraw>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<i64, Error> {
|
||||
let mut q = member_bank_withdraws::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_bank_withdraws::dsl::member_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.bank_name_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::bank_name.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.account_number_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::account_number.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.amount {
|
||||
q = q.filter(member_bank_withdraws::dsl::amount.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::memo.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
q = q.filter(member_bank_withdraws::dsl::state.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
q.count().get_result(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<Vec<models::MemberBankWithdraw>, Error> {
|
||||
let mut q = member_bank_withdraws::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = s.member_id {
|
||||
q = q.filter(member_bank_withdraws::dsl::member_id.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.bank_name_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::bank_name.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = &s.account_number_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::account_number.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.amount {
|
||||
q = q.filter(member_bank_withdraws::dsl::amount.eq(sp));
|
||||
}
|
||||
if let Some(sp) = &s.memo_like {
|
||||
q = q.filter(member_bank_withdraws::dsl::memo.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.state {
|
||||
q = q.filter(member_bank_withdraws::dsl::state.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(p) = &find_all.pagination {
|
||||
let page = p.page.unwrap_or(1);
|
||||
|
||||
if let Some(page_size) = p.page_size {
|
||||
q = q.offset(((page - 1) * page_size) as i64);
|
||||
q = q.limit(page_size as i64);
|
||||
}
|
||||
}
|
||||
if let Some(orderbys) = &find_all.sorts {
|
||||
for s in orderbys {
|
||||
match s {
|
||||
bcr::pagination::Sort::ASC(property) => match property.as_str() {
|
||||
"member_id" => {
|
||||
q = q.order_by(member_bank_withdraws::member_id.asc());
|
||||
}
|
||||
"bank_name" => {
|
||||
q = q.order_by(member_bank_withdraws::bank_name.asc());
|
||||
}
|
||||
"name" => {
|
||||
q = q.order_by(member_bank_withdraws::name.asc());
|
||||
}
|
||||
"account_number" => {
|
||||
q = q.order_by(member_bank_withdraws::account_number.asc());
|
||||
}
|
||||
"amount" => {
|
||||
q = q.order_by(member_bank_withdraws::amount.asc());
|
||||
}
|
||||
"state" => {
|
||||
q = q.order_by(member_bank_withdraws::state.asc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_bank_withdraws::created_at.asc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_bank_withdraws::updated_at.asc());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
bcr::pagination::Sort::DESC(property) => match property.as_str() {
|
||||
"member_id" => {
|
||||
q = q.order_by(member_bank_withdraws::member_id.desc());
|
||||
}
|
||||
"bank_name" => {
|
||||
q = q.order_by(member_bank_withdraws::bank_name.desc());
|
||||
}
|
||||
"name" => {
|
||||
q = q.order_by(member_bank_withdraws::name.desc());
|
||||
}
|
||||
"account_number" => {
|
||||
q = q.order_by(member_bank_withdraws::account_number.desc());
|
||||
}
|
||||
"amount" => {
|
||||
q = q.order_by(member_bank_withdraws::amount.desc());
|
||||
}
|
||||
"state" => {
|
||||
q = q.order_by(member_bank_withdraws::state.desc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_bank_withdraws::created_at.desc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_bank_withdraws::updated_at.desc());
|
||||
}
|
||||
|
||||
_ => {}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
q.load::<models::MemberBankWithdraw>(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberBankWithdraw,
|
||||
) -> Result<u64, Error> {
|
||||
use member_bank_withdraws::dsl;
|
||||
|
||||
diesel::update(dsl::member_bank_withdraws.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update_state(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberBankWithdrawForState,
|
||||
) -> Result<u64, Error> {
|
||||
use member_bank_withdraws::dsl;
|
||||
|
||||
diesel::update(dsl::member_bank_withdraws.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn delete(&self, conn: &diesel::PgConnection, id: uuid::Uuid) -> Result<u64, Error> {
|
||||
use member_bank_withdraws::dsl;
|
||||
|
||||
diesel::delete(member_bank_withdraws::table.filter(dsl::id.eq(id)))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, Debug, Clone, Copy, PartialEq, diesel_derive_enum::DbEnum)]
|
||||
pub enum MemberBankWithdrawState {
|
||||
Application = 1,
|
||||
Pending,
|
||||
Complete,
|
||||
}
|
||||
|
||||
table! {
|
||||
use diesel::sql_types::{Uuid, Text, BigInt, Nullable, Double};
|
||||
use super::MemberBankWithdrawStateMapping;
|
||||
|
||||
///
|
||||
member_bank_withdraws(id) {
|
||||
///
|
||||
id -> Uuid,
|
||||
///
|
||||
member_id -> Uuid,
|
||||
///
|
||||
bank_name -> Text,
|
||||
///
|
||||
name -> Text,
|
||||
///
|
||||
account_number -> Text,
|
||||
///
|
||||
amount -> Double,
|
||||
///
|
||||
password -> Text,
|
||||
///
|
||||
memo -> Nullable<Text>,
|
||||
///
|
||||
state -> MemberBankWithdrawStateMapping,
|
||||
///
|
||||
state_changed_at -> BigInt,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod models;
|
||||
///
|
||||
pub mod repository;
|
||||
///
|
||||
pub mod schema;
|
|
@ -1,64 +0,0 @@
|
|||
use super::schema::member_classes;
|
||||
use beteran_common_rust as bcr;
|
||||
|
||||
///
|
||||
#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, PartialOrd, Debug, Clone)]
|
||||
#[table_name = "member_classes"]
|
||||
pub struct MemberClass {
|
||||
///
|
||||
pub id: uuid::Uuid,
|
||||
///
|
||||
pub parent_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub show: bool,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "member_classes"]
|
||||
pub struct NewMemberClass {
|
||||
///
|
||||
pub parent_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub show: bool,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_classes"]
|
||||
pub struct ModifyMemberClass {
|
||||
///
|
||||
pub parent_id: Option<uuid::Uuid>,
|
||||
///
|
||||
pub name: String,
|
||||
///
|
||||
pub show: bool,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAllSearch {
|
||||
///
|
||||
pub name_like: Option<String>,
|
||||
///
|
||||
pub show: Option<bool>,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
///
|
||||
pub search: Option<FindAllSearch>,
|
||||
///
|
||||
pub pagination: Option<bcr::pagination::Pagination>,
|
||||
///
|
||||
pub sorts: Option<Vec<bcr::pagination::Sort>>,
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
use super::{models, schema::member_classes};
|
||||
use beteran_common_rust as bcr;
|
||||
use diesel::prelude::*;
|
||||
use diesel::result::Error;
|
||||
|
||||
///
|
||||
pub struct Repository {}
|
||||
|
||||
impl std::fmt::Debug for Repository {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.debug_struct("Repository of member_classes").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Repository {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Repository {
|
||||
///
|
||||
pub fn new() -> Repository {
|
||||
Repository {}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_member_class: &models::NewMemberClass,
|
||||
) -> Result<models::MemberClass, Error> {
|
||||
let inserted = diesel::insert_into(member_classes::table)
|
||||
.values(new_member_class)
|
||||
.get_result::<models::MemberClass>(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberClass>, Error> {
|
||||
match member_classes::table
|
||||
.find(id as uuid::Uuid)
|
||||
.first::<models::MemberClass>(conn)
|
||||
{
|
||||
Ok(m) => Ok(Some(m)),
|
||||
Err(e) => match e {
|
||||
diesel::result::Error::NotFound => Ok(None),
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all_count(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<i64, Error> {
|
||||
let mut q = member_classes::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_classes::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.show {
|
||||
q = q.filter(member_classes::dsl::show.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
q.count().get_result(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select_all(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
find_all: &models::FindAll,
|
||||
) -> Result<Vec<models::MemberClass>, Error> {
|
||||
let mut q = member_classes::table.into_boxed();
|
||||
|
||||
if let Some(s) = &find_all.search {
|
||||
if let Some(sp) = &s.name_like {
|
||||
q = q.filter(member_classes::dsl::name.like(sp));
|
||||
}
|
||||
if let Some(sp) = s.show {
|
||||
q = q.filter(member_classes::dsl::show.eq(sp));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(p) = &find_all.pagination {
|
||||
let page = p.page.unwrap_or(1);
|
||||
|
||||
if let Some(page_size) = p.page_size {
|
||||
q = q.offset(((page - 1) * page_size) as i64);
|
||||
q = q.limit(page_size as i64);
|
||||
}
|
||||
}
|
||||
if let Some(orderbys) = &find_all.sorts {
|
||||
for s in orderbys {
|
||||
match s {
|
||||
bcr::pagination::Sort::ASC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(member_classes::name.asc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_classes::created_at.asc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_classes::updated_at.asc());
|
||||
}
|
||||
|
||||
_ => {}
|
||||
},
|
||||
bcr::pagination::Sort::DESC(property) => match property.as_str() {
|
||||
"name" => {
|
||||
q = q.order_by(member_classes::name.desc());
|
||||
}
|
||||
"created_at" => {
|
||||
q = q.order_by(member_classes::created_at.desc());
|
||||
}
|
||||
"updated_at" => {
|
||||
q = q.order_by(member_classes::updated_at.desc());
|
||||
}
|
||||
|
||||
_ => {}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
q.load::<models::MemberClass>(conn)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn update(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
id: uuid::Uuid,
|
||||
modify: &models::ModifyMemberClass,
|
||||
) -> Result<u64, Error> {
|
||||
use member_classes::dsl;
|
||||
|
||||
diesel::update(dsl::member_classes.filter(dsl::id.eq(id)))
|
||||
.set(modify)
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn delete(&self, conn: &diesel::PgConnection, id: uuid::Uuid) -> Result<u64, Error> {
|
||||
use member_classes::dsl;
|
||||
|
||||
diesel::delete(member_classes::table.filter(dsl::id.eq(id)))
|
||||
.execute(conn)
|
||||
.map(|c| c as u64)
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
//!
|
||||
//!
|
||||
|
||||
table! {
|
||||
///
|
||||
member_classes(id) {
|
||||
///
|
||||
id -> Uuid,
|
||||
///
|
||||
parent_id -> Nullable<Uuid>,
|
||||
///
|
||||
name -> Text,
|
||||
///
|
||||
show -> Bool,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user