wag-managment-api-service-v.../a_project_files/drafts_and_notes/evyos-draft/evyos-draft-02-07-24

409 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#### Application Draft ####
Token (Save AS) => User => Employee => Menu
+ User ID
+ People ID
+ User Info
+ Employee ID
+ Request [IP + header]
+ List of reachable Endpoint Codes [Array]
+ CompanyId + CompanyUUID
+ DutyId + DutyUUID [duty_id]
+ Priority ID, Priority Code [priority_id ,priority_code]
Company & Customer [Common Attributes]
o User
o People
--- Customer [Structure]
Build +
BuildPart +
is_rentable = True (Life Space)
is_rentable = False (Non-life Space)
LivingSpace [Property] + // a human living in BuildPart in a given timeline
LivingSpace Branches
Property[Owner] +
Property[Tenant] +
Financial Assets +
--- Company [Gives Service]
Company +
Employee +
Company Responsiablity = Company[Employee] => Group[Customer]
--- Services [Receives Services]
+ Property Renovation Dues [Customer Financial Assets ]
+ Property Goverment Tax Dues [Customer Financial Assets ]
+ Property Building Dues [Customer Financial Assets ]
+ Heating Systems [HAG]
Optional Extra tutu
+ Cooling Systems [HAG]
+ Landscape Systems [HAG]
User Logins:
1. Company[Employee]
2. Property[Tenant]
3. Property[Owner]
- Primary Company Schema -
# Primary Company Roles #
SystemAdmin [Static] [Root Manager] [Application's Primary Management Office Employee]
+ Accesses all role and priviliges maintains management
Example: Groot => User can manage all access and permissions, access rules can not be manupilated or deleted
SystemUser [Static] < SystemAdmin
+ System storage and services are maintained by this role
- Can not reach any personel data in any case
I. Database [Database Manager]
II. Network [Network Manager]
III. Application Services [Application Manager]
Example: => IT Department of manager [Primary Company]
[System Admin] => SystemAdmin99 [People]
[Database Manager] => SystemUser96 [People]
[Network Manager] => SystemUser97 [People]
[Application Manager] => SystemUser98 [People]
for each company:
* Creates Company: [Company] = ABC Company
* Creates Employee: [Owner] & [SuperUser] = Owner & SuperUser
* Assigns Employee to Company: ABC Company Owner & ABC Company SuperUser
* Creates People: [People] = Jonathan
* Assigns People to Employee: [People] Jonathan -> [Employee] Owner = ABC Company Owner Jonathan
// if Owner==None: ilk atanan superuser=Owner
[Application Manager] => Company => Employee => People
- API -
// APi has primary company in its default settings
# Company Employee #
[Application Manager] Actions
Employee > Owner > People 1
Employee > SuperUser > People 1
Owner [Static] < [Application Manager] Johantan
* Can receive Access Token[Login]
* [Application Manager] => with SystemAdmin approval
- [Data] Can NOT manupilate data 4ex Change company info
- [Employee] Can create any role or permissions without any approval in its [Company]
SuperUser [Static] < [Application Manager] Johantan
* Can receive Access Token[Login]
* [Application Manager] => SystemAdmin approval
+ [Employee] Can create any role or permissions without any approval in its [Company]
+ [Data] Can manupilate data 4ex Change company info
- [Company] Can only receive [Data] to its own company [ReadOnly]
- SuperUser -> can grant User SuperUser => SystemAdmin approval
[SuperUser] => Employee => Rules&Restrictions
User:
[Dynamic] < [Application Manager]
// Defined Role 4ex [SuperUser] => access right [Login] = Access Token API connect
Annotations:
- When [SuperUser] creates a [Employee] approval=False until [Owner] approval & [Application Manager] sets approval=True
- Simult Test Algorith Codelanacak !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- Crud Collection'da mutlaka expire ile ilgili bi function olacak
- filter listlerin active, delete, regular(active==True and delete==False) function ayrı olacak
- create action lar BaseModellerin içinde olacak ya da (Optional) create, update rule based Inhert kulllan
- Pydanticler model_dump ve excluded_dump olarak inhr.
- Responselar herbiri Response status code, message, completed, data şeklinde olacak
- Create a initilizer with compose yaml.
- Cache ip address to avoid unnecessary request to Api[IP]
Build -> Data
Financial Assets -> Data
Personal Info -> People
Company A -> Company B -> Company C
Company B -> Company D
Company B -> Company E
Company B -> Company Z
score A > B > C
evyos A ankara A ayranci C
Company
1.Company A
2.Company B
3.Company C
4.Company D
5.Company E
6.Company F
Organization Cluster
1. Evyos Evyos Organizasyonu 385 0
2. Ankara Evyos Organizasyonu 385 1
3. Ayrancı Evyos Organizasyonu 385 2
4. BEsat Evyos Organizasyonu 385 2
5. KEsat Evyos Organizasyonu 385 2
6. Keklik Evyos Organizasyonu 385 3
7. İlker Evyos Organizasyonu 385 3
8. İstanbul Evyos Organizasyonu 385 1
9. Kayseri Evyos Organizasyonu 385 2
READ => company_id IN (2, 3, 4, 5, 6, 7)
WRITE => company_id IN (2)
READ => build_id IN (22, 333, 4444, 555, 6, 7)
WRITE => company_id IN (2)
Employee
id company_id employee
1 1 Genel Mudur Company A
2 1 Bekçi Company A
3 2 Genel Mudur Company B
4 2 Bekçi Company B
##### Access to data #####
Role based data access->
# Information Data Block #
Building Information Data -> Service Taker
Company Information Data -> Service Giver
# Offical Data Block #
Building Financial Data -> Service Taker
Company Financial Data -> Service Giver
#### Summary ####
Maximum amount of building a employee can be responsiable of? 50
Alg: Duty(Person) ->
Person = User
Access Token
(Service Giver)
Company R-> Department R-> Duty R-> Employee R-> Person
(Service Taker)
Company R-> Building R-> Person
Service Giver:
Company (related to) Job (related to) Employee (related to) Person
This flow indicates a hierarchical relationship where each entity is related to the next.
Company: The organization providing the service.
Duty: Specific roles or tasks within the company that are related to providing the service.
Employee: The individual performing the job-related tasks within the company.
Person: The individual as a person, highlighting the human element of the employee.
Service Taker:
Company (related to) Job (related to) Employee (related to) Building
This flow indicates a hierarchical relationship where each entity is related to the next, but with a different end point.
Company: The organization receiving the service.
Duty: Specific roles or tasks within the company that are related to managing or utilizing the service.
Employee: The individual performing the job-related tasks within the company.
Building: The physical location or facility where the service is utilized or managed.
duty_id = mapped_column(ForeignKey("duty.id"), nullable=False)
owner_id = mapped_column(ForeignKey("company.id"), nullable=False) X
member_id = mapped_column(ForeignKey("company.id"), nullable=False)
parent_id = mapped_column(ForeignKey("company.id"), nullable=False)
relationship_type = mapped_column(String, nullable=False)
child_count = mapped_column(Integer)
X company
duty_id ? Evyos GM -< Ankara GM Ayrancı GM
select query=
Company Sub
#### Filters ####
Add extra query to Crud:
{
"company_id_in": @Redis[Array],
"build_id_in": @Redis[Array],
"employee_id": @Redis[Array],
}
-------------------------------------------------------------------------------
# Query Pos.
o What are the employee branch? T
- Company filtereleyerek X
+ Mongo Db den brach ı cekerek
o What are sub companies under certain company_id? X
- CompanyRelationship Table like
+ Mongo Db den brach ı cekerek
o Who are my employess [Personel Info]?
EmployeeRelationship Table
Department -> Duty -> Employee
o What buildings are in my responsibilty?
BuildingRelationship Table
o What are certain debts of Build Parts?
CompanyRelationship Table ilke
o Iban and financial informations of Buildings?
AccountingRelationship Table ilke
o Salaries of a group of Employees?
X
o Duty information of a group of Employees?
X
o List Decision Book Items of a build part?
Build R-> Decision Book
Responsiable of related Building
Employee Query if Build view yetkisi varsa -> Decision Book
o Living Space info of a certian person?
Responsiable of related Building
Living Space -> Person Detail Infop
o Which build parts I am responsiable of?
Person -> Build Parts
Query employee -> Building
o Address of a person?
Query employee -> Building
o Email, phone personal info of a employee?
Brach Company
-------------------------------------------------------------------------------
User[Person] -> Employee Salaries Table data
User Company[Employee]
[Table]Company2BuildingRelationship
company_id build_id responsiable
1 3 True
2 3 False
Company2BuildingRelationship: Are these users of this company are responsiable from this building.
[Table]Company2EmployeeRelationship:
company_id employee_id
1 2
1 3
[Table]Company2CompanyRelationship:
1EVYOS 2Ankara 3Besat 4Ayrancı 5Dikmen 6Çayyolu 7Beysukent 8OsmanMah 9NecatiMah
2Ankara -> 3Besat 4Ayrancı 5Dikmen 6Çayyolu 7Beysukent -> 8OsmanMah 9NecatiMah
Top Hiercacy:
ADD field:
top_hiercacy_companies: id: 1, uuid: 1a1a51bd-67f5-4f85-bd7c-1edb6afdaa7e Evyos
Ask for branch ???
Update a branch ???
Delete a branch ???
Carry branch ???
Get "18aa001a-6878-4d39-bc21-0e63ba33beff" -> carry to "1a1a51bd-67f5-4f85-bd7c-1edb6afdaa7e"
DELETE -> INSERT
Go to mongo collection of top_hiercacy_company
--------------------------------------------------------------------------------
[Table]Company2CompanyRelationship: ??? Branch
owner_company_id member_company_id
1 2
2 3
3 4
1 5
1 6
class CompanyRelationship(CrudCollection):
"""
CompanyRelationship class based on declarative_base and CrudCollection via session
"""
__tablename__ = "company_relationship"
__exclude__fields__ = []
duty_id = mapped_column(ForeignKey("duty.id"), nullable=False)
owner_id = mapped_column(ForeignKey("company.id"), nullable=False)
member_id = mapped_column(ForeignKey("company.id"), nullable=False)
parent_id = mapped_column(ForeignKey("company.id"), nullable=False)
child_count = mapped_column(Integer)
json_text = mapped_column(String)
relationship_type = mapped_column(String, nullable=False)
Mehmet Karatay > Javascript
--------------------------------------------------------------------------------
EmployeeRelationship Table
X and Y Employee
Employee ->
Relationship
# Bindings of Queries #
Buildings [Decision Books, Project Books] 2 Resp.
Companies [Duty, Departments] 2 Resp.
Employees [Salaries, People] 2 Resp.
Accounts [Iban, Debits] 2 Resp.
People [LivingSpace, Users, Addresses] 2 Resp.
Role = Company + Job
Employee = Role + People
Employee R-> Employee
Employee R-> AccessRule ???
# Bindings of Actions #
INSERT -> Res? X
UPDATE -> Res? X
SELECT -> Res? |
DELETE -> Res?
ACTIVATE -> Res?
DESTROY -> Res?
id employee_id restrict_id by_who
1 2 3 2
2 2 4 2
3 2 5 2
1 -7 Genel Mudur
Permissions
A | 1 SuperUser
B | 2 Sub SuperUser
C | 3 Sub Sub SuperUser
A1 -> B2 -> C3
Many to Many
1 2