Refactored api calls to REST. Clients endpoint is now services without self. repository view is the same as get all services.

This commit is contained in:
2024-01-04 23:27:35 +01:00
parent 5fad1e678f
commit 68b7171852
4 changed files with 59 additions and 351 deletions

View File

@@ -1,6 +1,5 @@
from datetime import datetime
from enum import Enum
from typing import List
from pydantic import BaseModel
@@ -39,48 +38,6 @@ class Service(ServiceCreate):
orm_mode = True
#########################
# #
# Consumer #
# #
#########################
class ClientBase(BaseModel):
entity_did: str = "did:sov:test:1234"
service_uuid: str = "8e285c0c-4e40-430a-a477-26b3b81e30df"
other: dict = {"test": "test"}
class ClientCreate(ClientBase):
pass
class Client(ClientCreate):
id: int
class Config:
orm_mode = True
#########################
# #
# REPOSITORY #
# #
#########################
class RepositoryBase(ServiceBase):
pass
class RepositoryCreate(RepositoryBase):
entity_did: str = "did:sov:test:1234"
class Repository(RepositoryCreate):
time_created: datetime
class Config:
orm_mode = True
#########################
# #
# Entity #
@@ -90,7 +47,6 @@ class EntityBase(BaseModel):
did: str = "did:sov:test:1234"
name: str = "C1"
ip: str = "127.0.0.1"
attached: bool = False
visible: bool = True
other: dict = {
"network": "Carlo's Home Network",
@@ -103,9 +59,7 @@ class EntityCreate(EntityBase):
class Entity(EntityCreate):
services: List[Service] = []
clients: List[Client] = []
repository: List[Repository] = []
attached: bool
class Config:
orm_mode = True
@@ -116,8 +70,6 @@ class Entity(EntityCreate):
# Resolution #
# #
#########################
class ResolutionBase(BaseModel):
requester_name: str = "C1"
requester_did: str = "did:sov:test:1122"