Add all drawings to repo
This commit is contained in:
parent
e569d99077
commit
e3464e3647
44 changed files with 1247 additions and 0 deletions
117
drawings/appsec_achitecture/db_scheme.sql
Normal file
117
drawings/appsec_achitecture/db_scheme.sql
Normal file
|
@ -0,0 +1,117 @@
|
|||
CREATE TABLE "meta" (
|
||||
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
||||
"system_code" varchar(50) NOT NULL,
|
||||
"tool" uuid,
|
||||
"practice" varchar(32) NOT NULL,
|
||||
"build" varchar(250) NOT NULL,
|
||||
"enviroment" varchar(250) NOT NULL,
|
||||
"library" varchar(50),
|
||||
"method" varchar(10),
|
||||
"hash" varchar(500) NOT NULL,
|
||||
"created_at" datetime NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "tool" (
|
||||
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
||||
"tool" varchar(50) NOT NULL,
|
||||
"practive" varchar(20) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "problem" (
|
||||
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
||||
"executor" uuid,
|
||||
"is_created_manually" bool,
|
||||
"status" varchar(32) NOT NULL,
|
||||
"status_updated_at" datetime NOT NULL,
|
||||
"resolution" varchar(32),
|
||||
"priority" varchar(32) NOT NULL,
|
||||
"description" varchar(500),
|
||||
"remediation" varchar(500),
|
||||
"сategory" varchar(250),
|
||||
"cve" varchar(50),
|
||||
"cwe" varchar(500),
|
||||
"cvss" int,
|
||||
"location" varchar(500) NOT NULL,
|
||||
"defect_id" uuid,
|
||||
"defect_status" varchar(32),
|
||||
"created_at" datetime NOT NULL,
|
||||
"exception_date" datetime,
|
||||
"category" varchar(250),
|
||||
"hash" varchar(500) NOT NULL,
|
||||
"creator" uuid,
|
||||
"version" int NOT NULL,
|
||||
"group_id" uuid,
|
||||
"meta" uuid NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "user" (
|
||||
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
||||
"login" varchar(100) NOT NULL,
|
||||
"is_active" bool
|
||||
);
|
||||
|
||||
CREATE TABLE "problem_group" (
|
||||
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
||||
"name" varchar(50) NOT NULL,
|
||||
"description" varchar(300)
|
||||
);
|
||||
|
||||
CREATE TABLE "system" (
|
||||
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
||||
"name" varchar(50) NOT NULL,
|
||||
"code" varchar(50) NOT NULL,
|
||||
"buiseness_critical" bool,
|
||||
"security_critical" bool,
|
||||
"is_active" bool,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE TABLE "user_to_system" (
|
||||
"system_id" uuid NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
PRIMARY KEY ("system_id", "user_id")
|
||||
);
|
||||
|
||||
CREATE TABLE "comment" (
|
||||
"id" uuid PRIMARY KEY NOT NULL,
|
||||
"problem_id" uuid NOT NULL,
|
||||
"description" varchar(500) NOT NULL,
|
||||
"created_by" uuid NOT NULL,
|
||||
"created_at" datetime NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "work_history" (
|
||||
"id" uuid PRIMARY KEY NOT NULL,
|
||||
"problem_id" uuid NOT NULL,
|
||||
"action" varchar(100),
|
||||
"old_value" varchar(100),
|
||||
"new_value" varchar(100),
|
||||
"user_id" uuid NOT NULL,
|
||||
"created_at" datetime NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX ON "system" ("code");
|
||||
|
||||
ALTER TABLE "meta" ADD FOREIGN KEY ("system_code") REFERENCES "system" ("code");
|
||||
|
||||
ALTER TABLE "meta" ADD FOREIGN KEY ("tool") REFERENCES "tool" ("id");
|
||||
|
||||
ALTER TABLE "problem" ADD FOREIGN KEY ("executor") REFERENCES "user" ("id");
|
||||
|
||||
ALTER TABLE "problem" ADD FOREIGN KEY ("creator") REFERENCES "user" ("id");
|
||||
|
||||
ALTER TABLE "problem" ADD FOREIGN KEY ("group_id") REFERENCES "problem_group" ("id");
|
||||
|
||||
ALTER TABLE "problem" ADD FOREIGN KEY ("meta") REFERENCES "meta" ("id");
|
||||
|
||||
ALTER TABLE "user_to_system" ADD FOREIGN KEY ("system_id") REFERENCES "system" ("id");
|
||||
|
||||
ALTER TABLE "user_to_system" ADD FOREIGN KEY ("user_id") REFERENCES "user" ("id");
|
||||
|
||||
ALTER TABLE "comment" ADD FOREIGN KEY ("problem_id") REFERENCES "problem" ("id");
|
||||
|
||||
ALTER TABLE "comment" ADD FOREIGN KEY ("created_by") REFERENCES "user" ("id");
|
||||
|
||||
ALTER TABLE "work_history" ADD FOREIGN KEY ("problem_id") REFERENCES "problem" ("id");
|
||||
|
||||
ALTER TABLE "work_history" ADD FOREIGN KEY ("user_id") REFERENCES "user" ("id");
|
101
drawings/appsec_achitecture/db_scheme.txt
Normal file
101
drawings/appsec_achitecture/db_scheme.txt
Normal file
|
@ -0,0 +1,101 @@
|
|||
// Use DBML to define your database structure
|
||||
// Docs: https://dbml.dbdiagram.io/docs
|
||||
|
||||
Table meta {
|
||||
id uuid [pk, unique, not null]
|
||||
system_code varchar(50) [not null, ref: > system.code]
|
||||
tool uuid [ref: > tool.id]
|
||||
practice varchar(32) [not null]
|
||||
build varchar(250) [not null]
|
||||
enviroment varchar(250) [not null]
|
||||
library varchar(50)
|
||||
method varchar(10)
|
||||
hash varchar(500) [not null]
|
||||
created_at datetime [not null]
|
||||
}
|
||||
|
||||
Table tool {
|
||||
id uuid [pk, unique, not null]
|
||||
tool varchar(50) [not null]
|
||||
practive varchar(20) [not null]
|
||||
}
|
||||
|
||||
Table problem {
|
||||
id uuid [pk, unique, not null]
|
||||
executor uuid [ref: > user.id]
|
||||
is_created_manually bool
|
||||
status varchar(32) [not null]
|
||||
status_updated_at datetime [not null]
|
||||
resolution varchar(32)
|
||||
priority varchar(32) [not null]
|
||||
description varchar(500)
|
||||
remediation varchar(500)
|
||||
сategory varchar(250)
|
||||
cve varchar(50)
|
||||
cwe varchar(500)
|
||||
cvss int
|
||||
location varchar(500) [not null]
|
||||
defect_id uuid
|
||||
defect_status varchar(32)
|
||||
created_at datetime [not null]
|
||||
exception_date datetime
|
||||
category varchar(250)
|
||||
hash varchar(500) [not null]
|
||||
creator uuid [ref: > user.id]
|
||||
version int [not null]
|
||||
group_id uuid [ref: > problem_group.id ]
|
||||
|
||||
meta uuid [not null, ref: > meta.id]
|
||||
}
|
||||
|
||||
Table user {
|
||||
id uuid [pk, unique, not null]
|
||||
login varchar(100) [not null]
|
||||
is_active bool
|
||||
}
|
||||
|
||||
Table problem_group {
|
||||
id uuid [pk, unique, not null]
|
||||
name varchar(50) [not null]
|
||||
description varchar(300)
|
||||
}
|
||||
|
||||
Table system {
|
||||
id uuid [pk, unique, not null]
|
||||
name varchar(50) [not null]
|
||||
code varchar(50) [not null]
|
||||
buiseness_critical bool
|
||||
security_critical bool
|
||||
is_active bool
|
||||
|
||||
indexes {
|
||||
id [pk]
|
||||
code
|
||||
}
|
||||
}
|
||||
|
||||
Table user_to_system {
|
||||
system_id uuid [not null, ref: > system.id]
|
||||
user_id uuid [not null, ref: > user.id]
|
||||
indexes {
|
||||
(system_id, user_id) [pk, unique]
|
||||
}
|
||||
}
|
||||
|
||||
Table comment {
|
||||
id uuid [pk, not null]
|
||||
problem_id uuid [not null, ref: > problem.id]
|
||||
description varchar(500) [not null]
|
||||
created_by uuid [not null, ref: > user.id]
|
||||
created_at datetime [not null]
|
||||
}
|
||||
|
||||
Table work_history {
|
||||
id uuid [pk, not null]
|
||||
problem_id uuid [not null, ref: > problem.id]
|
||||
action varchar(100)
|
||||
old_value varchar(100)
|
||||
new_value varchar(100)
|
||||
user_id uuid [not null, ref: > user.id]
|
||||
created_at datetime [not null]
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
@startuml problem_meta_group
|
||||
|
||||
!include ../models/problem.puml
|
||||
!include ../models/meta.puml
|
||||
!include ../models/problem_group.puml
|
||||
|
||||
package Domain {
|
||||
|
||||
package Aggregates {
|
||||
struct ProblemMetaGroupAggregate {
|
||||
Problem Problem
|
||||
Meta Meta
|
||||
Groups []Group
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ProblemMetaGroupAggregate o-- Problem
|
||||
ProblemMetaGroupAggregate o-- Meta
|
||||
ProblemMetaGroupAggregate o-- Group
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,7 @@
|
|||
@startuml problem_meta_group_deatail
|
||||
|
||||
!include problem_meta_group.puml
|
||||
!include ../models/problem_detail.puml
|
||||
!include ../models/meta_detail.puml
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,24 @@
|
|||
@startuml problem_meta_aggregat
|
||||
|
||||
!include ../models/problem.puml
|
||||
!include ../models/meta.puml
|
||||
|
||||
package Domain {
|
||||
|
||||
package Aggregates {
|
||||
struct ProblemMetaReportAggregate {
|
||||
Problem Problem
|
||||
Meta Meta
|
||||
}
|
||||
|
||||
ProblemMetaReportAggregate o-- Problem
|
||||
ProblemMetaReportAggregate o-- Meta
|
||||
|
||||
note "Используется при разборе\nотчетов для передачи\nв Issue Processor" as ProblemMetaReportAggregateNote
|
||||
|
||||
ProblemMetaReportAggregateNote -- ProblemMetaReportAggregate
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,7 @@
|
|||
@startuml problem_meta_aggregat_detail
|
||||
|
||||
!include problem_meta_report.puml
|
||||
!include ../models/problem_detail.puml
|
||||
!include ../models/meta_detail.puml
|
||||
|
||||
@enduml
|
60
drawings/appsec_achitecture/domain/models/enums.puml
Normal file
60
drawings/appsec_achitecture/domain/models/enums.puml
Normal file
|
@ -0,0 +1,60 @@
|
|||
@startuml enums
|
||||
|
||||
package Domain {
|
||||
|
||||
package Models {
|
||||
enum Practice {
|
||||
BCA
|
||||
DAST
|
||||
MAST
|
||||
OSA
|
||||
SAST
|
||||
SCA
|
||||
}
|
||||
|
||||
enum HTTPMethod {
|
||||
GET
|
||||
POST
|
||||
PUT
|
||||
OPTIONS
|
||||
}
|
||||
|
||||
enum Status {
|
||||
Created
|
||||
Approving
|
||||
Open
|
||||
Closed
|
||||
InProcess
|
||||
Postponed
|
||||
}
|
||||
|
||||
enum Resolution {
|
||||
None
|
||||
FalsePositive
|
||||
Confirmed
|
||||
Fixed
|
||||
Exception
|
||||
}
|
||||
|
||||
enum Priority {
|
||||
NotDefined
|
||||
Low
|
||||
Medium
|
||||
High
|
||||
Critical
|
||||
}
|
||||
|
||||
enum DefectStatus {
|
||||
Created
|
||||
Open
|
||||
Analysis
|
||||
Correction
|
||||
Testing
|
||||
Postponed
|
||||
Closed
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@enduml
|
22
drawings/appsec_achitecture/domain/models/meta.puml
Normal file
22
drawings/appsec_achitecture/domain/models/meta.puml
Normal file
|
@ -0,0 +1,22 @@
|
|||
@startuml meta
|
||||
|
||||
package Domain {
|
||||
package Models {
|
||||
|
||||
struct Meta {
|
||||
Id uuid.UUID
|
||||
SystemCode string
|
||||
ToolCode string
|
||||
Practice string
|
||||
Build string
|
||||
Enviroment string
|
||||
Library string
|
||||
Method string
|
||||
Hash string
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@enduml
|
16
drawings/appsec_achitecture/domain/models/meta_detail.puml
Normal file
16
drawings/appsec_achitecture/domain/models/meta_detail.puml
Normal file
|
@ -0,0 +1,16 @@
|
|||
@startuml meta_detail
|
||||
|
||||
!include enums.puml
|
||||
!include meta.puml
|
||||
!include system.puml
|
||||
|
||||
Meta o-- Practice
|
||||
Meta o-- HTTPMethod
|
||||
|
||||
Meta o-- System
|
||||
|
||||
note "Содержит общую информацию\nдля несколькоих ПБ" as MetaNote
|
||||
|
||||
MetaNote -- Meta
|
||||
|
||||
@enduml
|
37
drawings/appsec_achitecture/domain/models/problem.puml
Normal file
37
drawings/appsec_achitecture/domain/models/problem.puml
Normal file
|
@ -0,0 +1,37 @@
|
|||
@startuml problem
|
||||
|
||||
package Domain {
|
||||
|
||||
package Models {
|
||||
struct Problem {
|
||||
Id uuid.UUID
|
||||
Executor User
|
||||
IsCreatedManually bool
|
||||
Status string
|
||||
StatusUpdatedAt time.Time
|
||||
Resolution string
|
||||
Priority string
|
||||
Description string
|
||||
Remedation string
|
||||
Category string
|
||||
CVE string
|
||||
CWE string
|
||||
CVSS string
|
||||
Location string
|
||||
DefectNumber int
|
||||
DefectStatus string
|
||||
PlannedFixingAt time.Time
|
||||
CreatedAt time.Time
|
||||
ExceptionDate time.Time
|
||||
Category string
|
||||
Hash string
|
||||
Creator User
|
||||
Version int
|
||||
Meta Meta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,16 @@
|
|||
@startuml problem_detail
|
||||
|
||||
!include enums.puml
|
||||
!include problem.puml
|
||||
!include meta.puml
|
||||
|
||||
Problem o-- Practice
|
||||
Problem o-- HTTPMethod
|
||||
Problem o-- Status
|
||||
Problem o-- Resolution
|
||||
Problem o-- Priority
|
||||
Problem o-- DefectStatus
|
||||
|
||||
Problem o-- Meta
|
||||
|
||||
@enduml
|
18
drawings/appsec_achitecture/domain/models/problem_group.puml
Normal file
18
drawings/appsec_achitecture/domain/models/problem_group.puml
Normal file
|
@ -0,0 +1,18 @@
|
|||
@startuml problem_group
|
||||
|
||||
package Domain {
|
||||
|
||||
package Models{
|
||||
|
||||
struct Group {
|
||||
Id uuid.UUID
|
||||
Name string
|
||||
Description string
|
||||
CreatedBy User
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,10 @@
|
|||
@startuml problem_group_detail
|
||||
|
||||
!include problem_group.puml
|
||||
!include problem_detail.puml
|
||||
!include user_detail.puml
|
||||
|
||||
Group o-- Problem
|
||||
Group o-- User
|
||||
|
||||
@enduml
|
18
drawings/appsec_achitecture/domain/models/system.puml
Normal file
18
drawings/appsec_achitecture/domain/models/system.puml
Normal file
|
@ -0,0 +1,18 @@
|
|||
@startuml system
|
||||
|
||||
package Domain {
|
||||
|
||||
package Models {
|
||||
struct System {
|
||||
Code string
|
||||
Name string
|
||||
BuisenessCritical bool
|
||||
SecurityCritical bool
|
||||
Area string
|
||||
IsActive bool
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@enduml
|
14
drawings/appsec_achitecture/domain/models/user.puml
Normal file
14
drawings/appsec_achitecture/domain/models/user.puml
Normal file
|
@ -0,0 +1,14 @@
|
|||
@startuml user
|
||||
|
||||
package Domain {
|
||||
|
||||
package Models {
|
||||
struct User {
|
||||
Login string
|
||||
IsActive bool
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@enduml
|
16
drawings/appsec_achitecture/domain/models/user_detail.puml
Normal file
16
drawings/appsec_achitecture/domain/models/user_detail.puml
Normal file
|
@ -0,0 +1,16 @@
|
|||
@startuml user_detail
|
||||
|
||||
!include user.puml
|
||||
|
||||
package Domain {
|
||||
package Models {
|
||||
|
||||
note "Внешняя связь к\nСфера Доступы и Роли" as UserExternalNote
|
||||
|
||||
UserExternalNote .. User
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
5
drawings/appsec_achitecture/issue_processor.puml
Normal file
5
drawings/appsec_achitecture/issue_processor.puml
Normal file
|
@ -0,0 +1,5 @@
|
|||
@startuml issueprocessor
|
||||
|
||||
!include repository/user_repo_detail.puml
|
||||
|
||||
@enduml
|
53
drawings/appsec_achitecture/report_parser/report_parser.puml
Normal file
53
drawings/appsec_achitecture/report_parser/report_parser.puml
Normal file
|
@ -0,0 +1,53 @@
|
|||
@startuml repoerparser
|
||||
|
||||
!include ../domain/aggregates/problem_meta_report_details.puml
|
||||
|
||||
package ReportParser {
|
||||
interface Parser {
|
||||
+ ReadReport(reader io.Reader) ([]ProblemMetaReportAggregate, error)
|
||||
}
|
||||
|
||||
class CodeScoringParser
|
||||
class KasperskyParser
|
||||
class StingrayParser
|
||||
class ZapParser
|
||||
class PTParser
|
||||
class SolarParser
|
||||
|
||||
Parser <|.. CodeScoringParser
|
||||
Parser <|.. KasperskyParser
|
||||
Parser <|.. StingrayParser
|
||||
Parser <|.. ZapParser
|
||||
Parser <|.. PTParser
|
||||
Parser <|.. SolarParser
|
||||
|
||||
Parser o-- ProblemMetaReportAggregate
|
||||
}
|
||||
|
||||
package Sender {
|
||||
|
||||
interface ProblemSender {
|
||||
+ SendProblem(problem ProblemMetaReportAggregate) error
|
||||
+ SendProblems(problems []ProblemMetaReportAggregate) error
|
||||
}
|
||||
|
||||
class KafkaSender {
|
||||
+ Address string
|
||||
}
|
||||
|
||||
ProblemSender <|.. KafkaSender
|
||||
ProblemSender o-- ProblemMetaReportAggregate
|
||||
}
|
||||
|
||||
|
||||
class ReportParserService{
|
||||
+ SetParser(parser Praser)
|
||||
+ SetSender(sender ProblemSender)
|
||||
+ MetricsHandler(ResponseWriter, *Request)
|
||||
+ HealthCheckHandler(ResponseWriter, *Request)
|
||||
}
|
||||
|
||||
ReportParserService o-- Parser
|
||||
ReportParserService o-- ProblemSender
|
||||
|
||||
@enduml
|
13
drawings/appsec_achitecture/repository/getter.puml
Normal file
13
drawings/appsec_achitecture/repository/getter.puml
Normal file
|
@ -0,0 +1,13 @@
|
|||
@startuml getter
|
||||
|
||||
package Repo {
|
||||
|
||||
struct GetOptions {
|
||||
Page int
|
||||
PerPage int
|
||||
Sorting map[string]interface{}
|
||||
Filters map[string]interface{}
|
||||
}
|
||||
}
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,9 @@
|
|||
@startuml getter_detail
|
||||
|
||||
!include getter.puml
|
||||
|
||||
note "Используется для пагинации\nсортировки и\nфильтрации результатов" as GetterNote
|
||||
|
||||
GetOptions .. GetterNote
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,13 @@
|
|||
@startuml pustgres_repo_base
|
||||
|
||||
package Repo {
|
||||
package Postgres {
|
||||
class PostgresRepo {
|
||||
+ Connect(ctx context.Context, connectionString string) error
|
||||
+ Ping(ctx context.Context) error
|
||||
- db *sql.DB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@enduml
|
8
drawings/appsec_achitecture/repository/repository.puml
Normal file
8
drawings/appsec_achitecture/repository/repository.puml
Normal file
|
@ -0,0 +1,8 @@
|
|||
@startuml repository
|
||||
|
||||
!include getter.puml
|
||||
!include system_repo.puml
|
||||
!include user_repo.puml
|
||||
!include user_system_repo.puml
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,8 @@
|
|||
@startuml repository_detail
|
||||
|
||||
!include getter_detail.puml
|
||||
!include system_repo_detail.puml
|
||||
!include user_repo_detail.puml
|
||||
!include user_system_repo_detail.puml
|
||||
|
||||
@enduml
|
21
drawings/appsec_achitecture/repository/system_repo.puml
Normal file
21
drawings/appsec_achitecture/repository/system_repo.puml
Normal file
|
@ -0,0 +1,21 @@
|
|||
@startuml system_repo
|
||||
|
||||
!include postgres/postgres.puml
|
||||
|
||||
package Repo {
|
||||
|
||||
interface SystemRepository{
|
||||
AddSystem(ctx context.Context, system domain.Models.System) (domain.Models.System, error)
|
||||
GetSystemByCode(ctx context.Context, code string) (domain.Models.System, error)
|
||||
GetSystems(ctx context.Context, options GetOptions) ([]domain.Models.System, error)
|
||||
UpdateSystem(ctx context.Context, system domain.Models.System)(domain.Modesl.System, error)
|
||||
DeleteSystem(ctx context.Context, system domain.Models.System)error
|
||||
}
|
||||
|
||||
class PostgresSystemRepository
|
||||
|
||||
SystemRepository <|-- PostgresSystemRepository
|
||||
PostgresRepo <|-- PostgresSystemRepository
|
||||
}
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,10 @@
|
|||
@startuml systemrepo_detail
|
||||
|
||||
!include system_repo.puml
|
||||
!include ../domain/models/system.puml
|
||||
!include getter_detail.puml
|
||||
|
||||
SystemRepository o-- GetOptions
|
||||
SystemRepository o-- System
|
||||
|
||||
@enduml
|
22
drawings/appsec_achitecture/repository/user_repo.puml
Normal file
22
drawings/appsec_achitecture/repository/user_repo.puml
Normal file
|
@ -0,0 +1,22 @@
|
|||
@startuml user_repo
|
||||
|
||||
!include postgres/postgres.puml
|
||||
|
||||
package Repo {
|
||||
|
||||
interface UserRepository {
|
||||
GetUserByLogin(ctx context.Context, login string) (domain.Models.User, error)
|
||||
AddUser(ctx context.Context, user domain.Models.User) (domain.Models.User, error)
|
||||
ChangeUser(ctx context.Conext, user domain.Models.User) (domain.Models.User, error)
|
||||
GetUsers(ctx context.Context, options GetOptions) ([]domain.Models.User, error)
|
||||
Deleteuser(ctx context.Context, login string) error
|
||||
}
|
||||
|
||||
class PostgresUserRepository
|
||||
|
||||
UserRepository <|-- PostgresUserRepository
|
||||
PostgresRepo <|-- PostgresUserRepository
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
12
drawings/appsec_achitecture/repository/user_repo_detail.puml
Normal file
12
drawings/appsec_achitecture/repository/user_repo_detail.puml
Normal file
|
@ -0,0 +1,12 @@
|
|||
@startuml user_repo_detail
|
||||
|
||||
!include user_repo.puml
|
||||
!include ../domain/models/user_detail.puml
|
||||
!include getter_detail.puml
|
||||
|
||||
package Repo {
|
||||
UserRepository o-- User
|
||||
UserRepository o-- GetOptions
|
||||
}
|
||||
|
||||
@enduml
|
25
drawings/appsec_achitecture/repository/user_system_repo.puml
Normal file
25
drawings/appsec_achitecture/repository/user_system_repo.puml
Normal file
|
@ -0,0 +1,25 @@
|
|||
@startuml usersystem_repo
|
||||
|
||||
!include postgres/postgres.puml
|
||||
|
||||
package Repo {
|
||||
interface UserSystemRepository{
|
||||
GetSystemUsers(ctx context.Context, system_code string) ([]UserSystemAggregate, error)
|
||||
AddUserToSystem(ctx context.Context, system_code string, user domain.Models.User) error
|
||||
RemoceUserFromSystem(ctx context.Context, system_code string, user domain.Models.User) error
|
||||
}
|
||||
|
||||
struct UserSystemAggregate {
|
||||
System domain.Models.System
|
||||
Users []domain.Models.User
|
||||
}
|
||||
|
||||
UserSystemRepository o-- UserSystemAggregate
|
||||
|
||||
class UserSystemPostgresRepo
|
||||
|
||||
UserSystemRepository <|-- UserSystemPostgresRepo
|
||||
PostgresRepo <|-- UserSystemPostgresRepo
|
||||
}
|
||||
|
||||
@enduml
|
|
@ -0,0 +1,10 @@
|
|||
@startuml usersystem_repo_detail
|
||||
|
||||
!include user_system_repo.puml
|
||||
!include ../domain/models/user_detail.puml
|
||||
!include ../domain/models/system.puml
|
||||
|
||||
UserSystemAggregate o-- System
|
||||
UserSystemAggregate o-- User
|
||||
|
||||
@enduml
|
34
drawings/cisco asa/policies_serialization.wsd
Normal file
34
drawings/cisco asa/policies_serialization.wsd
Normal file
|
@ -0,0 +1,34 @@
|
|||
@startuml
|
||||
!define RESULT <font color="blue">result</font>
|
||||
!define UNPARSED_RESULT <font color="green">unparsed_result</font>
|
||||
|
||||
start
|
||||
:Получаем данные, обработанные\nTextFSM со списком правил ACL <font color="red">acl_entries</font>;
|
||||
:Создаем два результирующих массива:
|
||||
- RESULT для хранения хороших результатов
|
||||
- UNPARSED_RESULT для хранения необработанных;
|
||||
:Начинаем итерацию по <font color="red">acl_entries</font>;
|
||||
repeat
|
||||
:Берем следующий элемент из <font color="red">acl_entries</font> - <font color="purple">acl_entry</font>;
|
||||
:Проверяем его содержание и в зависимости от\nнего обрабатываем соответственно;
|
||||
if (<font color="purple">acl_entry</font> = ACL header)
|
||||
:Пропускам элемент;
|
||||
elseif (<font color="purple">acl_entry</font> = unparsed ACE)
|
||||
:Записываем в список UNPARSED_RESULT;
|
||||
elseif (<font color="purple">acl_entry</font> = ACE)
|
||||
:Обрабатываем правило;
|
||||
note
|
||||
_parse_remark_acl_entry()
|
||||
end note
|
||||
:Добавляем обработанный результат в <font color="blue">results</font>;
|
||||
elseif (<font color="purple">acl_entry</font> = Remark)
|
||||
:Обрабатываем согласно правилам\nработы c Remark;
|
||||
note
|
||||
_parse_ace_acl_entry()
|
||||
end note
|
||||
:Добавляем обработанный результат в <font color="blue">results</font>;
|
||||
endif
|
||||
repeat while (В <font color="red">acl_entries</font> есть еще элементы?)
|
||||
:Возвращаем RESULT, UNPARSED_RESULT;
|
||||
stop
|
||||
@enduml
|
|
@ -0,0 +1,52 @@
|
|||
@startuml
|
||||
!define RESULT <font color="blue">result</font>
|
||||
!define CONCAT_RESULTS <font color="Violet">concat_results</font>
|
||||
!define TMP_ENTRY <font color="YellowGreen">tmp_entry</font>
|
||||
|
||||
start
|
||||
:Начинаем проходить по элементам RESULT;
|
||||
:Создаем массив CONCAT_RESULTS;
|
||||
:Создаем словарь TMP_ENTRY\nв которм будет собираться правило\nпо шаблону <font style="Monochrome">ace_template</font>;
|
||||
note
|
||||
ace_template = {
|
||||
"rule_id": 0,
|
||||
"enabled": True,
|
||||
"rule_numbers": [],
|
||||
"action": "",
|
||||
"source": [],
|
||||
"destination": [],
|
||||
"destination_service": "",
|
||||
"source_service": "",
|
||||
"hit_count": 0,
|
||||
"users": [],
|
||||
"logging": "",
|
||||
"logging_interval": "",
|
||||
"time_range": "",
|
||||
"description": "",
|
||||
"raw_entry": "",
|
||||
"raw_entries": [],
|
||||
"hash": "",
|
||||
"protocol": "",
|
||||
}
|
||||
endnote
|
||||
repeat
|
||||
:Берем следующий элемент RESULT;
|
||||
if (RESULT entry = ACE)
|
||||
:Записываем в поля TMP_ENTRY данные из RESULT entry
|
||||
согласно правилам ace;
|
||||
note
|
||||
_fill_template_with_ace_data()
|
||||
endnote
|
||||
:Добавяем TMP_ENTRY в CONCAT_RESULTS;
|
||||
:Сбрасываем ace_template в исходное значение;
|
||||
elseif (RESULT = remark)
|
||||
:Записываем в поля TMP_ENTRY данные из RESULT entry
|
||||
согласно правилам remark;
|
||||
note right
|
||||
_fill_template_with_remark_data()
|
||||
endnote
|
||||
endif
|
||||
repeat while (В RESULT есть еще элементы?)
|
||||
:Возвращаем CONCAT_RESULTS;
|
||||
stop
|
||||
@enduml
|
12
drawings/cisco asa/test.wsd
Normal file
12
drawings/cisco asa/test.wsd
Normal file
|
@ -0,0 +1,12 @@
|
|||
@startuml
|
||||
start
|
||||
:Берем значение поля destination из нераскрытого правила;
|
||||
:Проходимся его значением по списку network objects;
|
||||
if (Находится объект с таким именем?) then (да)
|
||||
:Поля сервиса ставятся на место поля destination в раскрытом списке правил;
|
||||
end
|
||||
else (нет)
|
||||
:В раскрытом списке правил ставится значение, которое было изначально;
|
||||
end
|
||||
endif
|
||||
@enduml
|
16
drawings/cisco_ftd/cisco_model.puml
Normal file
16
drawings/cisco_ftd/cisco_model.puml
Normal file
|
@ -0,0 +1,16 @@
|
|||
@startuml
|
||||
|
||||
class Cisco << (M,#FF7700) Model>> {
|
||||
cisco_type : CharField
|
||||
connection_type : CharField
|
||||
current_context : CharField
|
||||
enable_password : CharField
|
||||
multiple_mode : BooleanField
|
||||
password : CharField
|
||||
port : PositiveIntegerField
|
||||
protocol : CharField
|
||||
rsa_limit : IntegerField
|
||||
user : CharField
|
||||
}
|
||||
|
||||
@enduml
|
84
drawings/cisco_ftd/create_strategy.puml
Normal file
84
drawings/cisco_ftd/create_strategy.puml
Normal file
|
@ -0,0 +1,84 @@
|
|||
@startuml
|
||||
struct CiscoCreateData {
|
||||
+ ip: str
|
||||
+ login: str
|
||||
+ password: str
|
||||
+ port: str = DEFAULT_SSH_PORT
|
||||
+ device_name: str
|
||||
+ device_protocol: str
|
||||
+ manufacturer: str = CISCO_ASA_MANUFACTURER
|
||||
}
|
||||
|
||||
struct CiscoAuthenticationCheckDataPyModel {
|
||||
+ ip: str
|
||||
+ manufacturer: NOT NEEDED - SET CISCO
|
||||
+ login: str
|
||||
+ password: str
|
||||
+ port: int
|
||||
+ device_name: str
|
||||
}
|
||||
|
||||
|
||||
package CiscoApp {
|
||||
class AsaBackendService {
|
||||
+ {static} create_cisco_asa_insatnce(\n name: str,\n ip: str,\n user: str,\n password: str,\n enable_password: str,\n connection_type: Optional[str] = CONNECTION_CLI_TYPE,\n protocol: Optional[str] = CONNECTION_SSH_PROTOCOL,\n rsa_limit: Optional[int] = 0,\n port: Optional[str] = DEFAULT_ASA_PORT,\n description: Optional[str] = "",\n administrators: Optional[list] = None\n)
|
||||
}
|
||||
AsaBackendService --> CiscoASAUnifiedStrategy : "Использование статического\nметода create_cisco_asa_instance"
|
||||
|
||||
class CiscoFTDRepository {
|
||||
+ {static} create_instance(create_data: Dict)
|
||||
}
|
||||
CiscoFTDRepository --> CiscoFTDUnifiedStrategy : "Использование статического\nметода create_instance"
|
||||
|
||||
class CiscoFTDCreateDataModel {
|
||||
name: str
|
||||
ip: str
|
||||
username: str
|
||||
password: str
|
||||
connection_type: str = CONNECTION_CLI_TYPE
|
||||
port: int = DEFAULT_FTD_PORT
|
||||
description: str = ""
|
||||
administrators: List[int] = []
|
||||
}
|
||||
CiscoFTDCreateDataModel --> CiscoFTDRepository : "Pydantic model\nдля валидации create_data"
|
||||
|
||||
abstract CiscoUnifiedStrategyABC{
|
||||
+ create_instance(cisco_create_data: Dict)
|
||||
+ check_authentication_status(cisco_connect_data: Dict)
|
||||
}
|
||||
|
||||
|
||||
class CiscoFTDUnifiedStrategy {
|
||||
+ create_instance(cisco_create_data: Dict)
|
||||
+ check_authentication_status(cisco_connect_data: Dict)
|
||||
}
|
||||
CiscoFTDUnifiedStrategy ..|> CiscoUnifiedStrategyABC
|
||||
|
||||
class CiscoASAUnifiedStrategy {
|
||||
+ create_instance(cisco_create_data: Dict)
|
||||
+ check_authentication_status(cisco_connect_data: Dict)
|
||||
}
|
||||
CiscoASAUnifiedStrategy ..|> CiscoUnifiedStrategyABC
|
||||
|
||||
class CiscoUnifiedManager {
|
||||
+ cisco_create_strategy: CiscoCreateStrategyABC
|
||||
+ create_cisco_instance(cisco_create_data: Dict)
|
||||
+ check_authentication(cisco_connect_data: Dict)
|
||||
}
|
||||
CiscoUnifiedStrategyABC --* CiscoUnifiedManager
|
||||
CiscoUnifiedManager --* .PingServices.FirewallAuthStatusService
|
||||
}
|
||||
|
||||
package PingServices {
|
||||
class FirewallAuthStatusService {
|
||||
+ manufacturer: str
|
||||
+ ip: str
|
||||
+ login: str
|
||||
+ password: str
|
||||
+ port: str
|
||||
+ device_name: Optional[str]
|
||||
+ device_protocol: Optional[str]
|
||||
}
|
||||
}
|
||||
|
||||
@enduml
|
20
drawings/cisco_ftd/ftd_backend_service.puml
Normal file
20
drawings/cisco_ftd/ftd_backend_service.puml
Normal file
|
@ -0,0 +1,20 @@
|
|||
@startuml ftd_backend_service
|
||||
|
||||
!includesub ./ftd_model.puml!CiscoFTDModel
|
||||
|
||||
!startsub FTDBackendService
|
||||
class CiscoFTDBackendService {
|
||||
+ ftd_instance: CiscoFTD
|
||||
+ set_ftd_status(status_to_set: str) -> CiscoFTD
|
||||
+ form_cache_prefix() -> str
|
||||
+ flush_cache()
|
||||
+ set_cache_update_mutex()
|
||||
+ get_cache_update_mutex() -> str
|
||||
+ free_cache_update_mutex()
|
||||
# _check_connection(**kwargs)
|
||||
}
|
||||
!endsub
|
||||
|
||||
CiscoFTD --o CiscoFTDBackendService
|
||||
|
||||
@enduml
|
14
drawings/cisco_ftd/ftd_main.puml
Normal file
14
drawings/cisco_ftd/ftd_main.puml
Normal file
|
@ -0,0 +1,14 @@
|
|||
@startuml main
|
||||
|
||||
!includesub ./ftd_backend_service.puml!FTDBackendService
|
||||
!include ./ftd_model.puml
|
||||
!includesub ./ftd_repository.puml!CiscoFTDRepository
|
||||
!includesub ./ftd_operation_performers.puml!CISCOFTDSSHOPERATIONFACTORY
|
||||
!includesub ./ftd_operation_performers.puml!CISCOFTDCACHEOPERATIONFACTORY
|
||||
|
||||
CiscoFTDBackendService o-- CiscoFTD
|
||||
CiscoFTDSSHOperationFactory o-- CiscoFTD
|
||||
CiscoFTDCacheOperationFactory o-- CiscoFTD
|
||||
CiscoFTDRepository o-- CiscoFTD
|
||||
|
||||
@enduml
|
34
drawings/cisco_ftd/ftd_model.puml
Normal file
34
drawings/cisco_ftd/ftd_model.puml
Normal file
|
@ -0,0 +1,34 @@
|
|||
@startuml CiscoFTD
|
||||
|
||||
!include ./model_firewall.puml
|
||||
|
||||
!startsub CiscoFTDModel
|
||||
class CiscoFTD << (M,#FF7700) Model>> {
|
||||
+ username: CharField
|
||||
+ password: CharField
|
||||
+ protocol : CharField [FTDProtocolChoices]
|
||||
+ port : IntField
|
||||
+ active_node : ForeignKey
|
||||
+ administrators : ManyToManyField
|
||||
+ cluster : BooleanField
|
||||
+ cluster_data : JSONField
|
||||
+ description : CharField
|
||||
+ group : ForeignKey
|
||||
+ ip : CharField
|
||||
+ last_status_change : DateTimeField
|
||||
+ manufacturer : CharField
|
||||
+ name : CharField
|
||||
+ objects
|
||||
+ passive_node : ForeignKey
|
||||
+ status : CharField
|
||||
}
|
||||
!endsub
|
||||
|
||||
enum FTDProtocolChoices {
|
||||
SSH: "ssh"
|
||||
}
|
||||
|
||||
CiscoFTD <-- FTDProtocolChoices
|
||||
CiscoFTD --|> Firewall
|
||||
|
||||
@enduml
|
39
drawings/cisco_ftd/ftd_operation_performers.puml
Normal file
39
drawings/cisco_ftd/ftd_operation_performers.puml
Normal file
|
@ -0,0 +1,39 @@
|
|||
@startuml
|
||||
|
||||
!includesub ./ftd_model.puml!CiscoFTDModel
|
||||
!include ./ftd_ssh_strategy.puml
|
||||
|
||||
interface CiscoFTDFactoryInterfaces {
|
||||
+ perform_request()
|
||||
}
|
||||
|
||||
!startsub CISCOFTDSSHOPERATIONFACTORY
|
||||
class CiscoFTDSSHOperationFactory {
|
||||
+ ftd_instance: CiscoFTD
|
||||
+ request_data: Dict
|
||||
+ perform_request()
|
||||
+ @property\nftd_connect_data() -> Dict
|
||||
# _parse_client_data(client_data: Dict) -> Dict
|
||||
# _parse_ftd_response(ftd_response: str) -> Dict
|
||||
# _prepare_operation() -> CiscoFTDSSHOperation
|
||||
}
|
||||
!endsub
|
||||
|
||||
!startsub CISCOFTDCACHEOPERATIONFACTORY
|
||||
class CiscoFTDCacheOperationFactory {
|
||||
+ ftd_instance: CiscoFTD
|
||||
+ request_data: Dict
|
||||
+ perform_request()
|
||||
# _get_config() -> str
|
||||
}
|
||||
!endsub
|
||||
|
||||
CiscoFTD --o CiscoFTDCacheOperationFactory
|
||||
CiscoFTD --o CiscoFTDSSHOperationFactory
|
||||
|
||||
CiscoFTDSSHOperationFactory ..|> CiscoFTDFactoryInterfaces
|
||||
CiscoFTDCacheOperationFactory ..|> CiscoFTDFactoryInterfaces
|
||||
|
||||
CiscoFTDSSHOperationFactory *-- CiscoFTDSSHOperation
|
||||
|
||||
@enduml
|
38
drawings/cisco_ftd/ftd_pydantic.puml
Normal file
38
drawings/cisco_ftd/ftd_pydantic.puml
Normal file
|
@ -0,0 +1,38 @@
|
|||
@startuml
|
||||
|
||||
!startsub CISCO_FTD_PYDANTIC_CHECK_CONNECTION_DATA
|
||||
struct CiscoFTDAuthenticationModel <<(P,#fc0373) Pydantic Model>> {
|
||||
+ host: str
|
||||
+ username: str
|
||||
+ password: str
|
||||
+ port: Optional[str] = 22
|
||||
}
|
||||
!endsub
|
||||
|
||||
struct CiscoFTDSSHOperationCommandModel <<(P,#fc0373) Pydantic Model>> {
|
||||
+ command: str
|
||||
+ result: Union[str, List[Any], Dict[str, Any]] = ""
|
||||
}
|
||||
|
||||
!startsub CISCO_FTD_PYDANTIC_SSH_COMMANDS_LIST
|
||||
struct CiscoFTDSSHOperationCommandsListModel <<(P,#fc0373) Pydantic Model>> {
|
||||
+ commands: List[CiscoFTDSSHOperationCommand]
|
||||
}
|
||||
!endsub
|
||||
|
||||
!startsub CISCO_FTD_PYDANTIC_CREATE_DATA_MODEL
|
||||
struct CiscoFTDCreateDataModel <<(P,#fc0373) Pydantic Model>> {
|
||||
name: str
|
||||
ip: str
|
||||
username: str
|
||||
password: str
|
||||
connection_type: str = CONNECTION_CLI_TYPE
|
||||
port: int = DEFAULT_FTD_PORT
|
||||
description: str = ""
|
||||
administrators: List[int] = []
|
||||
}
|
||||
!endsub
|
||||
|
||||
CiscoFTDSSHOperationCommandModel ..> CiscoFTDSSHOperationCommandsListModel
|
||||
|
||||
@enduml
|
21
drawings/cisco_ftd/ftd_repository.puml
Normal file
21
drawings/cisco_ftd/ftd_repository.puml
Normal file
|
@ -0,0 +1,21 @@
|
|||
@startuml ftd_repository
|
||||
|
||||
!includesub ./ftd_model.puml!CiscoFTDModel
|
||||
!includesub ./ftd_pydantic.puml!CISCO_FTD_PYDANTIC_CHECK_CONNECTION_DATA
|
||||
!includesub ./ftd_pydantic.puml!CISCO_FTD_PYDANTIC_CREATE_DATA_MODEL
|
||||
|
||||
!startsub CiscoFTDRepository
|
||||
class CiscoFTDRepository {
|
||||
+ ftd_instance: CiscoFTD
|
||||
+ {static} create_instance(**kwargs)
|
||||
+ update_instance(**kwargs)
|
||||
+ delete_instance()
|
||||
}
|
||||
!endsub
|
||||
|
||||
CiscoFTDRepository o-- CiscoFTD
|
||||
CiscoFTDRepository --> CiscoFTDAuthenticationModel
|
||||
CiscoFTDRepository --> CiscoFTDCreateDataModel
|
||||
CiscoFTDAuthenticationModel .. CiscoFTDCreateDataModel
|
||||
|
||||
@enduml
|
16
drawings/cisco_ftd/ftd_ssh_strategy.puml
Normal file
16
drawings/cisco_ftd/ftd_ssh_strategy.puml
Normal file
|
@ -0,0 +1,16 @@
|
|||
@startuml
|
||||
|
||||
!includesub ./ftd_pydantic.puml!CISCO_FTD_PYDANTIC_SSH_COMMANDS_LIST
|
||||
!includesub ./ftd_pydantic.puml!CISCO_FTD_PYDANTIC_CHECK_CONNECTION_DATA
|
||||
|
||||
class CiscoFTDSSHOperation {
|
||||
+ connect_data: Dict
|
||||
+ commands: Dict
|
||||
+ request_data: Dict
|
||||
+ perform_operation()
|
||||
}
|
||||
|
||||
CiscoFTDSSHOperation --> CiscoFTDAuthenticationModel
|
||||
CiscoFTDSSHOperation --> CiscoFTDSSHOperationCommandsListModel
|
||||
|
||||
@enduml
|
17
drawings/cisco_ftd/model_firewall.puml
Normal file
17
drawings/cisco_ftd/model_firewall.puml
Normal file
|
@ -0,0 +1,17 @@
|
|||
@startuml
|
||||
class Firewall << (M,#FF7700) Model>> {
|
||||
active_node : ForeignKey
|
||||
administrators : ManyToManyField
|
||||
cluster : BooleanField
|
||||
cluster_data : JSONField
|
||||
description : CharField
|
||||
group : ForeignKey
|
||||
ip : CharField
|
||||
last_status_change : DateTimeField
|
||||
manufacturer : CharField
|
||||
name : CharField
|
||||
objects
|
||||
passive_node : ForeignKey
|
||||
status : CharField
|
||||
}
|
||||
@enduml
|
20
drawings/request_center/block_schemes/add_field.puml
Normal file
20
drawings/request_center/block_schemes/add_field.puml
Normal file
|
@ -0,0 +1,20 @@
|
|||
@startuml
|
||||
start
|
||||
:Добавить новое поле
|
||||
на этап запроса;
|
||||
if (Поле блочное) then (yes)
|
||||
:Выбор типа блочного поля;
|
||||
:Указание параметров, уникальных
|
||||
для выбранного блочного поля;
|
||||
else (no)
|
||||
:Указываем название поля;
|
||||
:Указываем обязательное ли поле;
|
||||
:Указываем дополнительные параметры;
|
||||
if (Тип поля in\n[multiselct, select]) then (yes)
|
||||
:Выбираем источник данных;
|
||||
else (no)
|
||||
endif
|
||||
endif
|
||||
:Добавление поля в этап;
|
||||
end
|
||||
@enduml
|
115
drawings/request_center/scheme.puml
Normal file
115
drawings/request_center/scheme.puml
Normal file
|
@ -0,0 +1,115 @@
|
|||
@startuml
|
||||
|
||||
!theme plain
|
||||
hide empty methods
|
||||
|
||||
!procedure $table($name, $slug)
|
||||
entity "<b>$name</b>" as $slug << (T, Orange) table >>
|
||||
!endprocedure
|
||||
|
||||
!procedure $type($name, $slug)
|
||||
entity "<b>$name</b>" as $slug << (E, Cyan) type (enum) >>
|
||||
!endprocedure
|
||||
|
||||
!procedure $pk($name)
|
||||
<color:#GoldenRod><&key></color> <b><i>$name</i></b>:
|
||||
!endprocedure
|
||||
|
||||
!procedure $enum_link($name)
|
||||
<color:#Orange><&tag></color> <i>$name</i>:
|
||||
!endprocedure
|
||||
|
||||
!procedure $fk($name)
|
||||
<color:#Silver><&key></color> <i>$name</i>:
|
||||
!endprocedure
|
||||
|
||||
!procedure $column($name)
|
||||
{field} <color:#grey><&chevron-right></color> <i>$name</i>:
|
||||
!endprocedure
|
||||
|
||||
!procedure $enum_field($name)
|
||||
{field} <color:#grey><&chevron-right></color> $name
|
||||
!endprocedure
|
||||
|
||||
|
||||
$table("FIELD", "field") {
|
||||
$pk("ID") INTEGER NOT NULL
|
||||
$enum_link("TYPE") VARCHAR
|
||||
$fk("STEP_ID") INTEGER NOT NULL
|
||||
$fk("BLOCK_FIELD_ID") INTEGER NOT NULL
|
||||
$column("REQUIRED") BOOLEAN
|
||||
}
|
||||
|
||||
$table("BLOCK_FIELD", "block_field") {
|
||||
$pk("ID") INTEGER NOT NULL
|
||||
$fk("STEP_ID") INTEGER NOT NULL
|
||||
$column("NAME") VARCHAR
|
||||
$enum_link("TYPE") VARCHAR NOT NULL
|
||||
$column("REQUIRED") BOOLEAN
|
||||
$column("FLAGS") JSON
|
||||
}
|
||||
|
||||
$table("STEP", "step") {
|
||||
$pk("ID") INTEGER NOT NULL
|
||||
$fk("WORKFLOW_ID") INTEGER NOT NULL
|
||||
$column("NAME") VARCHAR
|
||||
$column("DESCRIPTION") TEXT
|
||||
$column("NEED_AGREEMENT") BOOLEAN
|
||||
}
|
||||
|
||||
$table("RESPONSIBLE", "responsible") {
|
||||
$pk("ID") INTEGER NOT NULL
|
||||
$fk("STEP_ID") INTEGER NOT NULL
|
||||
$column("ASSIGNATION_TYPE") VARCHAR
|
||||
$column("EXECUTION_TYPE") VARCHAR
|
||||
$column("USERS") INTEGER[]
|
||||
}
|
||||
|
||||
$table("WORKFLOW", "workflow") {
|
||||
$pk("ID") INTEGER NOT NULL
|
||||
$column("NAME") VARCHAR
|
||||
$column("CREATED_AT") TIMESTAMP
|
||||
$enum_link("TYPE") VARCHAR
|
||||
$enum_link("STATUS") VARCHAR
|
||||
$column("DESCRIPTION") TEXT
|
||||
}
|
||||
|
||||
$type("FIELD_TYPE", "field_type") {
|
||||
$enum_field("select")
|
||||
$enum_field("input")
|
||||
$enum_field("datetime")
|
||||
$enum_field("multiselect")
|
||||
$enum_field("filefield")
|
||||
$enum_field("blockfield")
|
||||
}
|
||||
|
||||
$type("BLOCK_FIELD_TYPE", "block_field_type") {
|
||||
$enum_field("allow_access_field")
|
||||
$enum_field("object")
|
||||
$enum_field("device")
|
||||
}
|
||||
|
||||
$type("WORKFLOW_TYPE", "workflow_type") {
|
||||
$enum_field("general")
|
||||
$enum_field("access_change")
|
||||
$enum_field("object_change")
|
||||
$enum_field("custom")
|
||||
}
|
||||
|
||||
$type("WORKFLOW_STATUS", "workflow_status") {
|
||||
$enum_field("active")
|
||||
$enum_field("inactive")
|
||||
$enum_field("draft")
|
||||
}
|
||||
|
||||
field::TYPE -- field_type
|
||||
field::BLOCK_FIELD_ID }o--|| block_field::ID
|
||||
workflow::TYPE -- workflow_type
|
||||
workflow::STATUS -- workflow_status
|
||||
field::STEP }o--|| step::ID
|
||||
block_field::STEP }o--|| step::ID
|
||||
block_field::TYPE -- block_field_type
|
||||
step::WORKFLOW_ID }|--|| workflow::ID
|
||||
responsible::STEP_ID ||--|| step::ID
|
||||
|
||||
@enduml
|
Loading…
Reference in a new issue