소스 검색

Merge branch 'sumer' into storage-upload-to-any-provider

Mokhtar Naamani 4 년 전
부모
커밋
1fea95e1ab
2개의 변경된 파일92개의 추가작업 그리고 85개의 파일을 삭제
  1. 3 3
      query-node/package.json
  2. 89 82
      query-node/schema.graphql

+ 3 - 3
query-node/package.json

@@ -37,11 +37,11 @@
     "tslib": "^2.0.0",
     "@types/bn.js": "^4.11.6",
     "bn.js": "^5.1.2",
-    "@dzlzv/hydra-cli": "2.0.0-beta",
-    "@dzlzv/hydra-processor": "0.1.1"
+    "@dzlzv/hydra-cli": "2.0.1-beta.16",
+    "@dzlzv/hydra-processor": "2.0.1-beta.16"
   },
   "devDependencies": {
-    "@dzlzv/hydra-typegen": "0.0.3-1"
+    "@dzlzv/hydra-typegen": "2.0.1-beta.16"
   },
   "volta": {
 		"extends": "../package.json"

+ 89 - 82
query-node/schema.graphql

@@ -1,22 +1,9 @@
-# temporary type used before `DateTime` type is working
-type DateTime @entity {
-  timestamp: BigInt!
-}
-
 enum Network {
   BABYLON
   ALEXANDRIA
   ROME
 }
 
-type Block @entity {
-  "Block number as a string"
-  id: ID!
-  block: Int!
-  executedAt: DateTime!
-  network: Network!
-}
-
 enum MembershipEntryMethod {
   PAID
   SCREENING
@@ -44,7 +31,7 @@ type Membership @entity {
   rootAccount: String!
 
   "Blocknumber when member was registered"
-  registeredAtBlock: Block!
+  registeredAtBlock: BigInt!
 
   "Timestamp when member was registered"
   registeredAtTime: DateTime!
@@ -65,55 +52,19 @@ type ChannelCategory @entity {
 
   channels: [Channel!] @derivedFrom(field: "category")
 
-  happenedIn: Block!
-}
-
-"Storage asset"
-union Asset = AssetUrl | AssetStorage
-
-"Asset stored at an external source"
-type AssetUrl @variant {
-  id: ID!
-
-  "The http url pointing to the media"
-  url: String!
-}
-
-"Asset was never fully uploaded."
-type AssetNeverProvided @variant {
-  happenedIn: Block!
-}
-
-"Asset was deleted and is no longer available."
-type AssetDeleted @variant {
-  happenedIn: Block!
+  happenedIn: BigInt!
 }
 
-"Status of an asset upload"
-type AssetUploadStatus @variant {
-  """
-  Data object in upload life-cycle.
-  If this is deleted, then set oldDataObject in its place if it is set and not rejected, otherwise union goes to Deleted.
-  """
-  dataObject: AssetDataObject!
-
-  """
-  Possible prior data object which was in some stage of upload life-cycle when new one was initiated.
-  If accepted, then apps may chose to use old in place of new before it is accepted.
-  If this is deleted, then set to null.
-  """
-  oldDataObject: AssetDataObject
-
-  happenedIn: Block!
-}
-
-union AssetStorageUploadStatus = AssetNeverProvided | AssetDeleted | AssetUploadStatus
+"Asset availability representation"
+enum AssetAvailability {
+  "Asset is available in storage"
+  ACCEPTED,
 
-type AssetStorage @variant {
-  id: ID!
+  "Asset is being uploaded to storage"
+  PENDING,
 
-  "Upload to content directory status"
-  uploadStatus: AssetStorageUploadStatus!
+  "Anvalid storage (meta)data used"
+  INVALID,
 }
 
 "The decision of the storage provider when it acts as liaison"
@@ -129,12 +80,12 @@ enum LiaisonJudgement {
 }
 
 "Manages content ids, type and storage provider decision about it"
-type AssetDataObject @entity {
+type DataObject @entity {
   "Content owner"
-  owner: AssetOwner!
+  owner: DataObjectOwner!
 
   "Content added at"
-  addedAt: Block!
+  addedAt: BigInt!
 
   "Content type id"
   typeId: Int!
@@ -156,34 +107,44 @@ type AssetDataObject @entity {
 }
 
 "Owner type for storage object"
-union AssetOwner = AssetOwnerMember | AssetOwnerChannel | AssetOwnerDao | AssetOwnerCouncil | AssetOwnerWorkingGroup
+union DataObjectOwner = DataObjectOwnerMember
+  | DataObjectOwnerChannel
+  | DataObjectOwnerDao
+  | DataObjectOwnerCouncil
+  | DataObjectOwnerWorkingGroup
 
 "Asset owned by a member"
-type AssetOwnerMember @variant {
+type DataObjectOwnerMember @variant {
   "Member identifier"
-  memberId: BigInt!
+  memberId: Membership!
+
+  "Variant needs to have at least one property. This value is not used."
+  dummy: Int!
 }
 
 "Asset owned by a channel"
-type AssetOwnerChannel @variant {
+type DataObjectOwnerChannel @variant {
   "Channel identifier"
   channel: Channel!
+
+  "Variant needs to have at least one property. This value is not used."
+  dummy: Int!
 }
 
 "Asset owned by a DAO"
-type AssetOwnerDao @variant {
+type DataObjectOwnerDao @variant {
   "DAO identifier"
   daoId: BigInt!
 }
 
 "Asset owned by the Council"
-type AssetOwnerCouncil @variant {
+type DataObjectOwnerCouncil @variant {
   "Variant needs to have at least one property. This value is not used."
   dummy: Int!
 }
 
 "Asset owned by a WorkingGroup"
-type AssetOwnerWorkingGroup @variant {
+type DataObjectOwnerWorkingGroup @variant {
   "Working group identifier"
   workingGroupId: BigInt!
 }
@@ -197,7 +158,7 @@ type Language @entity {
   "Language identifier ISO 639-1"
   iso: String!
 
-  happenedIn: Block!
+  happenedIn: BigInt!
 }
 
 type Channel @entity {
@@ -219,11 +180,33 @@ type Channel @entity {
   "The description of a Channel"
   description: String
 
-  "Channel's cover (background) photo. Recommended ratio: 16:9."
-  coverPhoto: Asset
+  ### Cover photo asset ###
+
+  # Channel's cover (background) photo. Recommended ratio: 16:9.
+
+  "Asset's data object"
+  coverPhotoDataObject: DataObject
+
+  "URLs where the asset content can be accessed (if any)"
+  coverPhotoUrls: [String!]
+
+  "Availability meta information"
+  coverPhotoAvailability: AssetAvailability!
+
+  ### Avatar photo asset ###
+
+  # Channel's avatar photo.
+
+  "Asset's data object"
+  avatarDataObject: DataObject
+
+  "URLs where the asset content can be accessed (if any)"
+  avatarUrls: [String!]
 
-  "Channel's avatar photo."
-  avatarPhoto: Asset
+  "Availability meta information"
+  avatarAvailability: AssetAvailability!
+
+  ##########################
 
   "Flag signaling whether a channel is public."
   isPublic: Boolean
@@ -236,7 +219,7 @@ type Channel @entity {
 
   videos: [Video!] @derivedFrom(field: "channel")
 
-  happenedIn: Block!
+  happenedIn: BigInt!
 }
 
 type VideoCategory @entity {
@@ -248,7 +231,7 @@ type VideoCategory @entity {
 
   videos: [Video!] @derivedFrom(field: "category")
 
-  happenedIn: Block!
+  happenedIn: BigInt!
 }
 
 type Video @entity {
@@ -270,8 +253,20 @@ type Video @entity {
   "Video duration in seconds"
   duration: Int
 
-  "Video thumbnail (recommended ratio: 16:9)"
-  thumbnail: Asset
+  ### Thumbnail asset ###
+
+  # Video thumbnail (recommended ratio: 16:9)
+
+  "Asset's data object"
+  thumbnailDataObject: DataObject
+
+  "URLs where the asset content can be accessed (if any)"
+  thumbnailUrls: [String!]
+
+  "Availability meta information"
+  thumbnailAvailability: AssetAvailability!
+
+  ##########################
 
   "Video's main langauge"
   language: Language
@@ -294,13 +289,25 @@ type Video @entity {
   "License under the video is published"
   license: License
 
-  "Reference to video asset"
-  media: Asset
+  ### Media asset ###
+
+  # Reference to video asset
+
+  "Asset's data object"
+  mediaDataObject: DataObject
+
+  "URLs where the asset content can be accessed (if any)"
+  mediaUrls: [String!]
+
+  "Availability meta information"
+  mediaAvailability: AssetAvailability!
+
+  ##########################
 
   "Video file metadata"
   mediaMetadata: VideoMediaMetadata
 
-  happenedIn: Block!
+  happenedIn: BigInt!
 
   "Is video featured or not"
   isFeatured: Boolean!
@@ -326,7 +333,7 @@ type VideoMediaMetadata @entity {
 
   video: Video @derivedFrom(field: "mediaMetadata")
 
-  happenedIn: Block!
+  happenedIn: BigInt!
 }
 
 type VideoMediaEncoding @entity {