Prechádzať zdrojové kódy

query node - adapting mappings to runtime changes (content censorship + liaison judgement)

ondratra 3 rokov pred
rodič
commit
d769bb9ba7

+ 19 - 12
query-node/generated/graphql-server/.env

@@ -1,14 +1,21 @@
-DEBUG=*
-PGUSER=postgres
-NODE_ENV=development
-WARTHOG_AUTO_OPEN_PLAYGROUND=false
-WARTHOG_AUTO_GENERATE_FILES=false
-WARTHOG_APP_HOST=localhost
-WARTHOG_APP_PORT=4100
-WARTHOG_DB_DATABASE=query-node
+WARTHOG_INTROSPECTION=true
+WARTHOG_SUBSCRIPTIONS=true
+WARTHOG_PLAYGROUND=true
+WARTHOG_DB_SYNCHRONIZE=false
+WARTHOG_DB_OVERRIDE=false
+WARTHOG_DB_DATABASE=query_node_processor
+WARTHOG_DB_USERNAME=postgres
+WARTHOG_DB_PASSWORD=postgres
 WARTHOG_DB_HOST=localhost
-WARTHOG_DB_LOGGING=all
-WARTHOG_DB_PASSWORD=
 WARTHOG_DB_PORT=5432
-WARTHOG_DB_SYNCHRONIZE=true
-WARTHOG_DB_USERNAME=postgres
+WARTHOG_APP_PORT=4002
+WARTHOG_APP_HOST=localhost
+GRAPHQL_SERVER_PORT=4002
+GRAPHQL_SERVER_HOST=localhost
+PGDATABASE=query_node_processor
+PGUSER=postgres
+PGPASSWORD=postgres
+PGHOST=localhost
+PGPORT=5432
+DEBUG=qnode-cli:*
+NODE_ENV=development

+ 2 - 2
query-node/generated/graphql-server/db/migrations/channelCategoriesByName.migration.ts

@@ -1,7 +1,7 @@
 import { MigrationInterface, QueryRunner } from "typeorm";
 
-export class ChannelCategoriesByNameMigration1617953675055 implements MigrationInterface {
-    name = 'channelCategoriesByNameMigration1617953675055'
+export class ChannelCategoriesByNameMigration1617981663820 implements MigrationInterface {
+    name = 'channelCategoriesByNameMigration1617981663820'
 
     public async up(queryRunner: QueryRunner): Promise<void> {
         // TODO: escape 

+ 2 - 2
query-node/generated/graphql-server/db/migrations/membersByHandle.migration.ts

@@ -1,7 +1,7 @@
 import { MigrationInterface, QueryRunner } from "typeorm";
 
-export class MembersByHandleMigration1617953675056 implements MigrationInterface {
-    name = 'membersByHandleMigration1617953675056'
+export class MembersByHandleMigration1617981663821 implements MigrationInterface {
+    name = 'membersByHandleMigration1617981663821'
 
     public async up(queryRunner: QueryRunner): Promise<void> {
         // TODO: escape 

+ 2 - 2
query-node/generated/graphql-server/db/migrations/search.migration.ts

@@ -1,7 +1,7 @@
 import { MigrationInterface, QueryRunner } from "typeorm";
 
-export class SearchMigration1617953675054 implements MigrationInterface {
-    name = 'searchMigration1617953675054'
+export class SearchMigration1617981663819 implements MigrationInterface {
+    name = 'searchMigration1617981663819'
 
     public async up(queryRunner: QueryRunner): Promise<void> {
         // TODO: escape 

+ 2 - 2
query-node/generated/graphql-server/db/migrations/videoCategoriesByName.migration.ts

@@ -1,7 +1,7 @@
 import { MigrationInterface, QueryRunner } from "typeorm";
 
-export class VideoCategoriesByNameMigration1617953675056 implements MigrationInterface {
-    name = 'videoCategoriesByNameMigration1617953675056'
+export class VideoCategoriesByNameMigration1617981663821 implements MigrationInterface {
+    name = 'videoCategoriesByNameMigration1617981663821'
 
     public async up(queryRunner: QueryRunner): Promise<void> {
         // TODO: escape 

+ 0 - 1
query-node/generated/graphql-server/src/modules/enums/enums.ts

@@ -16,5 +16,4 @@ export enum AssetAvailability {
 export enum LiaisonJudgement {
   PENDING = 'PENDING',
   ACCEPTED = 'ACCEPTED',
-  REJECTED = 'REJECTED',
 }

+ 47 - 207
query-node/generated/types/content.ts

@@ -355,17 +355,18 @@ export namespace Content {
       );
     }
   }
-  export class ChannelCensoredEvent {
+  export class ChannelCensorshipStatusUpdatedEvent {
     public readonly expectedParamTypes = [
       "ContentActor",
       "ChannelId",
+      "bool",
       "Vec<u8>"
     ];
 
     constructor(public readonly ctx: SubstrateEvent) {}
 
-    get data(): ChannelCensored_Params {
-      return new ChannelCensored_Params(this.ctx);
+    get data(): ChannelCensorshipStatusUpdated_Params {
+      return new ChannelCensorshipStatusUpdated_Params(this.ctx);
     }
 
     validateParams(): boolean {
@@ -382,7 +383,7 @@ export namespace Content {
     }
   }
 
-  class ChannelCensored_Params {
+  class ChannelCensorshipStatusUpdated_Params {
     constructor(public readonly ctx: SubstrateEvent) {}
 
     get contentActor(): ContentActor {
@@ -399,59 +400,15 @@ export namespace Content {
       ]);
     }
 
-    get bytes(): Bytes {
-      return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
+    get bool(): bool {
+      return createTypeUnsafe<bool & Codec>(typeRegistry, "bool", [
         this.ctx.params[2].value
       ]);
     }
-  }
-  export class ChannelUncensoredEvent {
-    public readonly expectedParamTypes = [
-      "ContentActor",
-      "ChannelId",
-      "Vec<u8>"
-    ];
-
-    constructor(public readonly ctx: SubstrateEvent) {}
-
-    get data(): ChannelUncensored_Params {
-      return new ChannelUncensored_Params(this.ctx);
-    }
-
-    validateParams(): boolean {
-      if (this.expectedParamTypes.length !== this.ctx.params.length) {
-        return false;
-      }
-      let valid = true;
-      this.expectedParamTypes.forEach((type, i) => {
-        if (type !== this.ctx.params[i].type) {
-          valid = false;
-        }
-      });
-      return valid;
-    }
-  }
-
-  class ChannelUncensored_Params {
-    constructor(public readonly ctx: SubstrateEvent) {}
-
-    get contentActor(): ContentActor {
-      return createTypeUnsafe<ContentActor & Codec>(
-        typeRegistry,
-        "ContentActor",
-        [this.ctx.params[0].value]
-      );
-    }
-
-    get channelId(): ChannelId {
-      return createTypeUnsafe<ChannelId & Codec>(typeRegistry, "ChannelId", [
-        this.ctx.params[1].value
-      ]);
-    }
 
     get bytes(): Bytes {
       return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
-        this.ctx.params[2].value
+        this.ctx.params[3].value
       ]);
     }
   }
@@ -1050,13 +1007,18 @@ export namespace Content {
       ]);
     }
   }
-  export class VideoCensoredEvent {
-    public readonly expectedParamTypes = ["ContentActor", "VideoId", "Vec<u8>"];
+  export class VideoCensorshipStatusUpdatedEvent {
+    public readonly expectedParamTypes = [
+      "ContentActor",
+      "VideoId",
+      "bool",
+      "Vec<u8>"
+    ];
 
     constructor(public readonly ctx: SubstrateEvent) {}
 
-    get data(): VideoCensored_Params {
-      return new VideoCensored_Params(this.ctx);
+    get data(): VideoCensorshipStatusUpdated_Params {
+      return new VideoCensorshipStatusUpdated_Params(this.ctx);
     }
 
     validateParams(): boolean {
@@ -1073,7 +1035,7 @@ export namespace Content {
     }
   }
 
-  class VideoCensored_Params {
+  class VideoCensorshipStatusUpdated_Params {
     constructor(public readonly ctx: SubstrateEvent) {}
 
     get contentActor(): ContentActor {
@@ -1090,55 +1052,15 @@ export namespace Content {
       ]);
     }
 
-    get bytes(): Bytes {
-      return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
+    get bool(): bool {
+      return createTypeUnsafe<bool & Codec>(typeRegistry, "bool", [
         this.ctx.params[2].value
       ]);
     }
-  }
-  export class VideoUncensoredEvent {
-    public readonly expectedParamTypes = ["ContentActor", "VideoId", "Vec<u8>"];
-
-    constructor(public readonly ctx: SubstrateEvent) {}
-
-    get data(): VideoUncensored_Params {
-      return new VideoUncensored_Params(this.ctx);
-    }
-
-    validateParams(): boolean {
-      if (this.expectedParamTypes.length !== this.ctx.params.length) {
-        return false;
-      }
-      let valid = true;
-      this.expectedParamTypes.forEach((type, i) => {
-        if (type !== this.ctx.params[i].type) {
-          valid = false;
-        }
-      });
-      return valid;
-    }
-  }
-
-  class VideoUncensored_Params {
-    constructor(public readonly ctx: SubstrateEvent) {}
-
-    get contentActor(): ContentActor {
-      return createTypeUnsafe<ContentActor & Codec>(
-        typeRegistry,
-        "ContentActor",
-        [this.ctx.params[0].value]
-      );
-    }
-
-    get videoId(): VideoId {
-      return createTypeUnsafe<VideoId & Codec>(typeRegistry, "VideoId", [
-        this.ctx.params[1].value
-      ]);
-    }
 
     get bytes(): Bytes {
       return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
-        this.ctx.params[2].value
+        this.ctx.params[3].value
       ]);
     }
   }
@@ -1537,9 +1459,14 @@ export namespace Content {
       );
     }
   }
-  export class CensorChannelCall {
+  export class UpdateChannelCensorshipStatusCall {
     public readonly extrinsic: SubstrateExtrinsic;
-    public readonly expectedArgTypes = ["ContentActor", "ChannelId", "Bytes"];
+    public readonly expectedArgTypes = [
+      "ContentActor",
+      "ChannelId",
+      "bool",
+      "Bytes"
+    ];
 
     constructor(public readonly ctx: SubstrateEvent) {
       if (ctx.extrinsic === undefined) {
@@ -1548,8 +1475,8 @@ export namespace Content {
       this.extrinsic = ctx.extrinsic;
     }
 
-    get args(): CensorChannel_Args {
-      return new CensorChannel_Args(this.extrinsic);
+    get args(): UpdateChannelCensorshipStatus_Args {
+      return new UpdateChannelCensorshipStatus_Args(this.extrinsic);
     }
 
     validateArgs(): boolean {
@@ -1566,7 +1493,7 @@ export namespace Content {
     }
   }
 
-  class CensorChannel_Args {
+  class UpdateChannelCensorshipStatus_Args {
     constructor(public readonly extrinsic: SubstrateExtrinsic) {}
 
     get actor(): ContentActor {
@@ -1583,61 +1510,15 @@ export namespace Content {
       ]);
     }
 
-    get rationale(): Bytes {
-      return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
+    get isCensored(): bool {
+      return createTypeUnsafe<bool & Codec>(typeRegistry, "bool", [
         this.extrinsic.args[2].value
       ]);
     }
-  }
-  export class UncensorChannelCall {
-    public readonly extrinsic: SubstrateExtrinsic;
-    public readonly expectedArgTypes = ["ContentActor", "ChannelId", "Bytes"];
-
-    constructor(public readonly ctx: SubstrateEvent) {
-      if (ctx.extrinsic === undefined) {
-        throw new Error(`No call data has been provided`);
-      }
-      this.extrinsic = ctx.extrinsic;
-    }
-
-    get args(): UncensorChannel_Args {
-      return new UncensorChannel_Args(this.extrinsic);
-    }
-
-    validateArgs(): boolean {
-      if (this.expectedArgTypes.length !== this.extrinsic.args.length) {
-        return false;
-      }
-      let valid = true;
-      this.expectedArgTypes.forEach((type, i) => {
-        if (type !== this.extrinsic.args[i].type) {
-          valid = false;
-        }
-      });
-      return valid;
-    }
-  }
-
-  class UncensorChannel_Args {
-    constructor(public readonly extrinsic: SubstrateExtrinsic) {}
-
-    get actor(): ContentActor {
-      return createTypeUnsafe<ContentActor & Codec>(
-        typeRegistry,
-        "ContentActor",
-        [this.extrinsic.args[0].value]
-      );
-    }
-
-    get channelId(): ChannelId {
-      return createTypeUnsafe<ChannelId & Codec>(typeRegistry, "ChannelId", [
-        this.extrinsic.args[1].value
-      ]);
-    }
 
     get rationale(): Bytes {
       return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
-        this.extrinsic.args[2].value
+        this.extrinsic.args[3].value
       ]);
     }
   }
@@ -2529,9 +2410,14 @@ export namespace Content {
       ]);
     }
   }
-  export class CensorVideoCall {
+  export class UpdateVideoCensorshipStatusCall {
     public readonly extrinsic: SubstrateExtrinsic;
-    public readonly expectedArgTypes = ["ContentActor", "VideoId", "Bytes"];
+    public readonly expectedArgTypes = [
+      "ContentActor",
+      "VideoId",
+      "bool",
+      "Bytes"
+    ];
 
     constructor(public readonly ctx: SubstrateEvent) {
       if (ctx.extrinsic === undefined) {
@@ -2540,8 +2426,8 @@ export namespace Content {
       this.extrinsic = ctx.extrinsic;
     }
 
-    get args(): CensorVideo_Args {
-      return new CensorVideo_Args(this.extrinsic);
+    get args(): UpdateVideoCensorshipStatus_Args {
+      return new UpdateVideoCensorshipStatus_Args(this.extrinsic);
     }
 
     validateArgs(): boolean {
@@ -2558,7 +2444,7 @@ export namespace Content {
     }
   }
 
-  class CensorVideo_Args {
+  class UpdateVideoCensorshipStatus_Args {
     constructor(public readonly extrinsic: SubstrateExtrinsic) {}
 
     get actor(): ContentActor {
@@ -2575,61 +2461,15 @@ export namespace Content {
       ]);
     }
 
-    get rationale(): Bytes {
-      return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
+    get isCensored(): bool {
+      return createTypeUnsafe<bool & Codec>(typeRegistry, "bool", [
         this.extrinsic.args[2].value
       ]);
     }
-  }
-  export class UncensorVideoCall {
-    public readonly extrinsic: SubstrateExtrinsic;
-    public readonly expectedArgTypes = ["ContentActor", "VideoId", "Bytes"];
-
-    constructor(public readonly ctx: SubstrateEvent) {
-      if (ctx.extrinsic === undefined) {
-        throw new Error(`No call data has been provided`);
-      }
-      this.extrinsic = ctx.extrinsic;
-    }
-
-    get args(): UncensorVideo_Args {
-      return new UncensorVideo_Args(this.extrinsic);
-    }
-
-    validateArgs(): boolean {
-      if (this.expectedArgTypes.length !== this.extrinsic.args.length) {
-        return false;
-      }
-      let valid = true;
-      this.expectedArgTypes.forEach((type, i) => {
-        if (type !== this.extrinsic.args[i].type) {
-          valid = false;
-        }
-      });
-      return valid;
-    }
-  }
-
-  class UncensorVideo_Args {
-    constructor(public readonly extrinsic: SubstrateExtrinsic) {}
-
-    get actor(): ContentActor {
-      return createTypeUnsafe<ContentActor & Codec>(
-        typeRegistry,
-        "ContentActor",
-        [this.extrinsic.args[0].value]
-      );
-    }
-
-    get videoId(): VideoId {
-      return createTypeUnsafe<VideoId & Codec>(typeRegistry, "VideoId", [
-        this.extrinsic.args[1].value
-      ]);
-    }
 
     get rationale(): Bytes {
       return createTypeUnsafe<Bytes & Codec>(typeRegistry, "Bytes", [
-        this.extrinsic.args[2].value
+        this.extrinsic.args[3].value
       ]);
     }
   }

+ 3 - 52
query-node/generated/types/data-directory.ts

@@ -260,7 +260,7 @@ export namespace DataDirectory {
 
   /**
    *  Adds the content to the system. The created DataObject
-   *  awaits liaison to accept or reject it.
+   *  awaits liaison to accept it.
    */
   export class AddContentCall {
     public readonly extrinsic: SubstrateExtrinsic;
@@ -366,7 +366,8 @@ export namespace DataDirectory {
   }
   /**
    *  Storage provider accepts a content. Requires signed storage provider account and its id.
-   *  The LiaisonJudgement can be updated, but only by the liaison.
+   *  The LiaisonJudgement can only be updated once from Pending to Accepted.
+   *  Subsequent calls are a no-op.
    */
   export class AcceptContentCall {
     public readonly extrinsic: SubstrateExtrinsic;
@@ -414,56 +415,6 @@ export namespace DataDirectory {
       ]);
     }
   }
-  /**
-   *  Storage provider rejects a content. Requires signed storage provider account and its id.
-   *  The LiaisonJudgement can be updated, but only by the liaison.
-   */
-  export class RejectContentCall {
-    public readonly extrinsic: SubstrateExtrinsic;
-    public readonly expectedArgTypes = ["StorageProviderId", "ContentId"];
-
-    constructor(public readonly ctx: SubstrateEvent) {
-      if (ctx.extrinsic === undefined) {
-        throw new Error(`No call data has been provided`);
-      }
-      this.extrinsic = ctx.extrinsic;
-    }
-
-    get args(): RejectContent_Args {
-      return new RejectContent_Args(this.extrinsic);
-    }
-
-    validateArgs(): boolean {
-      if (this.expectedArgTypes.length !== this.extrinsic.args.length) {
-        return false;
-      }
-      let valid = true;
-      this.expectedArgTypes.forEach((type, i) => {
-        if (type !== this.extrinsic.args[i].type) {
-          valid = false;
-        }
-      });
-      return valid;
-    }
-  }
-
-  class RejectContent_Args {
-    constructor(public readonly extrinsic: SubstrateExtrinsic) {}
-
-    get storageProviderId(): StorageProviderId {
-      return createTypeUnsafe<StorageProviderId & Codec>(
-        typeRegistry,
-        "StorageProviderId",
-        [this.extrinsic.args[0].value]
-      );
-    }
-
-    get contentId(): ContentId {
-      return createTypeUnsafe<ContentId & Codec>(typeRegistry, "ContentId", [
-        this.extrinsic.args[1].value
-      ]);
-    }
-  }
   /**
    *  Locks / unlocks content uploading
    */

+ 31 - 4
query-node/generated/types/members.ts

@@ -3,13 +3,17 @@ import { SubstrateEvent, SubstrateExtrinsic } from "@dzlzv/hydra-common";
 import { Codec } from "@polkadot/types/types";
 import { typeRegistry } from ".";
 
-import { MemberId, PaidTermId } from "@joystream/types/augment";
-import { AccountId } from "@polkadot/types/interfaces";
+import { EntryMethod, MemberId, PaidTermId } from "@joystream/types/augment";
+import { AccountId, BalanceOf } from "@polkadot/types/interfaces";
 import { Bytes, Option } from "@polkadot/types";
 
 export namespace Members {
   export class MemberRegisteredEvent {
-    public readonly expectedParamTypes = ["MemberId", "AccountId"];
+    public readonly expectedParamTypes = [
+      "MemberId",
+      "AccountId",
+      "EntryMethod<PaidTermId, AccountId>"
+    ];
 
     constructor(public readonly ctx: SubstrateEvent) {}
 
@@ -45,6 +49,14 @@ export namespace Members {
         this.ctx.params[1].value
       ]);
     }
+
+    get entryMethod(): EntryMethod {
+      return createTypeUnsafe<EntryMethod & Codec>(
+        typeRegistry,
+        "EntryMethod",
+        [this.ctx.params[2].value]
+      );
+    }
   }
   export class MemberUpdatedAboutTextEvent {
     public readonly expectedParamTypes = ["MemberId"];
@@ -289,13 +301,20 @@ export namespace Members {
       );
     }
   }
+  /**
+   *  Screened members are awarded a initial locked balance that can only be slashed or used
+   *  for fees, and is not transferable. The screening authority must ensure that the provided
+   *  new_member_account was verified to avoid applying locks arbitrarily to accounts not controlled
+   *  by the member.
+   */
   export class AddScreenedMemberCall {
     public readonly extrinsic: SubstrateExtrinsic;
     public readonly expectedArgTypes = [
       "AccountId",
       "Option<Bytes>",
       "Option<Bytes>",
-      "Option<Bytes>"
+      "Option<Bytes>",
+      "Option<BalanceOf>"
     ];
 
     constructor(public readonly ctx: SubstrateEvent) {
@@ -355,6 +374,14 @@ export namespace Members {
         [this.extrinsic.args[3].value]
       );
     }
+
+    get initialBalance(): Option<BalanceOf> {
+      return createTypeUnsafe<Option<BalanceOf> & Codec>(
+        typeRegistry,
+        "Option<BalanceOf>",
+        [this.extrinsic.args[4].value]
+      );
+    }
   }
   /**
    *  Change member's about text

+ 7 - 15
query-node/manifest.yml

@@ -11,6 +11,7 @@ entities:
 typegen:
   metadata:
     source: wss://sumer.joystream.app
+    #source: ws://localhost:9944 # use this to download types from local node (useful during development)
   events:
     # membership
     - members.MemberRegistered
@@ -28,8 +29,7 @@ typegen:
     - content.ChannelCreated
     - content.ChannelUpdated
     - content.ChannelAssetsRemoved
-    - content.ChannelCensored
-    - content.ChannelUncensored
+    - content.ChannelCensorshipStatusUpdated
     - content.ChannelOwnershipTransferRequested
     - content.ChannelOwnershipTransferRequestWithdrawn
     - content.ChannelOwnershipTransferred
@@ -42,8 +42,7 @@ typegen:
     - content.VideoCreated
     - content.VideoUpdated
     - content.VideoDeleted
-    - content.VideoCensored
-    - content.VideoUncensored
+    - content.VideoCensorshipStatusUpdated
     - content.FeaturedVideosSet
 
     # storage
@@ -70,8 +69,7 @@ typegen:
     - content.create_channel
     - content.update_channel
     - content.remove_channel_assets
-    - content.censor_channel
-    - content.uncensor_channel
+    - content.update_channel_censorship_status
     - content.create_channel_category
     - content.update_channel_category
     - content.delete_channel_category
@@ -89,14 +87,12 @@ typegen:
     - content.update_video_category
     - content.delete_video_category
     - content.remove_person_from_video
-    - content.censor_video
-    - content.uncensor_video
+    - content.update_video_censorship_status
 
     # storage
     - data_directory.add_content
     - data_directory.remove_content
     - data_directory.accept_content
-    - data_directory.reject_content
     - data_directory.update_content_uploading_status
 
   outDir: ./generated/types
@@ -168,10 +164,8 @@ mappings:
       handler: content_VideoUpdated(DatabaseManager, SubstrateEvent)
     - event: content.VideoDeleted
       handler: content_VideoDeleted(DatabaseManager, SubstrateEvent)
-    - event: content.VideoCensored
-      handler: content_VideoCensored(DatabaseManager, SubstrateEvent)
-    - event: content.VideoUncensored
-      handler: content_VideoUncensored(DatabaseManager, SubstrateEvent)
+    - event: content.VideoCensorshipStatusUpdated
+      handler: content_VideoCensorshipStatusUpdated(DatabaseManager, SubstrateEvent)
     - event: content.FeaturedVideosSet
       handler: content_FeaturedVideosSet(DatabaseManager, SubstrateEvent)
 
@@ -182,8 +176,6 @@ mappings:
       handler: data_directory_ContentRemoved(DatabaseManager, SubstrateEvent)
     - event: data_directory.ContentAccepted
       handler: data_directory_ContentAccepted(DatabaseManager, SubstrateEvent)
-    - event: data_directory.ContentRejected
-      handler: data_directory_ContentRejected(DatabaseManager, SubstrateEvent)
     - event: data_directory.ContentUploadingStatusUpdated
       handler: data_directory_ContentUploadingStatusUpdated(DatabaseManager, SubstrateEvent)
 

+ 4 - 33
query-node/mappings/src/content/channel.ts

@@ -144,12 +144,12 @@ export async function content_ChannelAssetsRemoved(
 }
 
 // eslint-disable-next-line @typescript-eslint/naming-convention
-export async function content_ChannelCensored(
+export async function content_ChannelCensorshipStatusUpdated(
   db: DatabaseManager,
   event: SubstrateEvent
 ) {
   // read event data
-  const {channelId} = new Content.ChannelCensoredEvent(event).data
+  const {channelId, bool: isCensored} = new Content.ChannelCensorshipStatusUpdatedEvent(event).data
 
   // load event
   const channel = await db.get(Channel, { where: { id: channelId } })
@@ -160,7 +160,7 @@ export async function content_ChannelCensored(
   }
 
   // update channel
-  channel.isCensored = true;
+  channel.isCensored = isCensored.isTrue;
 
   // set last update time
   channel.updatedAt = new Date(event.blockTimestamp.toNumber())
@@ -169,36 +169,7 @@ export async function content_ChannelCensored(
   await db.save<Channel>(channel)
 
   // emit log event
-  logger.info('Channel has been censored', {id: channelId})
-}
-
-// eslint-disable-next-line @typescript-eslint/naming-convention
-export async function content_ChannelUncensored(
-  db: DatabaseManager,
-  event: SubstrateEvent
-) {
-  // read event data
-  const {channelId} = new Content.ChannelUncensoredEvent(event).data
-
-  // load event
-  const channel = await db.get(Channel, { where: { id: channelId } })
-
-  // ensure channel exists
-  if (!channel) {
-    return inconsistentState('Non-existing channel uncensoring requested', channelId)
-  }
-
-  // update channel
-  channel.isCensored = false;
-
-  // set last update time
-  channel.updatedAt = new Date(event.blockTimestamp.toNumber())
-
-  // save channel
-  await db.save<Channel>(channel)
-
-  // emit log event
-  logger.info('Channel has been uncensored', {id: channel.id})
+  logger.info('Channel censorship status has been updated', {id: channelId, isCensored: isCensored.isTrue})
 }
 
 /////////////////// ChannelCategory ////////////////////////////////////////////

+ 0 - 1
query-node/mappings/src/content/utils.ts

@@ -352,7 +352,6 @@ function integrateAsset<T>(propertyName: string, result: Object, asset: AssetSto
   const conversionTable = {
     [LiaisonJudgement.ACCEPTED]: AssetAvailability.ACCEPTED,
     [LiaisonJudgement.PENDING]: AssetAvailability.PENDING,
-    [LiaisonJudgement.REJECTED]: AssetAvailability.INVALID,
   }
 
   // (un)set asset's properties

+ 5 - 33
query-node/mappings/src/content/video.ts

@@ -283,53 +283,25 @@ export async function content_VideoDeleted(
   logger.info('Video has been deleted', {id: videoId})
 }
 
-// eslint-disable-next-line @typescript-eslint/naming-convention
-export async function content_VideoCensored(
-  db: DatabaseManager,
-  event: SubstrateEvent
-) {
-  // read event data
-  const {videoId} = new Content.VideoCensoredEvent(event).data
-
-  // load video
-  const video = await db.get(Video, { where: { id: videoId } })
-
-  // ensure video exists
-  if (!video) {
-    return inconsistentState('Non-existing video censoring requested', videoId)
-  }
-
-  // update video
-  video.isCensored = true;
-
-  // set last update time
-  video.updatedAt = new Date(event.blockTimestamp.toNumber())
-
-  // save video
-  await db.save<Video>(video)
-
-  // emit log event
-  logger.info('Video has been censored', {id: videoId})
-}
 
 // eslint-disable-next-line @typescript-eslint/naming-convention
-export async function content_VideoUncensored(
+export async function content_VideoCensorshipStatusUpdated(
   db: DatabaseManager,
   event: SubstrateEvent
 ) {
   // read event data
-  const {videoId} = new Content.VideoUncensoredEvent(event).data
+  const {videoId, bool: isCensored} = new Content.VideoCensorshipStatusUpdatedEvent(event).data
 
   // load video
   const video = await db.get(Video, { where: { id: videoId } })
 
   // ensure video exists
   if (!video) {
-    return inconsistentState('Non-existing video uncensoring requested', videoId)
+    return inconsistentState('Non-existing video censoring requested', videoId)
   }
 
   // update video
-  video.isCensored = false;
+  video.isCensored = isCensored.isTrue;
 
   // set last update time
   video.updatedAt = new Date(event.blockTimestamp.toNumber())
@@ -338,7 +310,7 @@ export async function content_VideoUncensored(
   await db.save<Video>(video)
 
   // emit log event
-  logger.info('Video has been uncensored', {id: videoId})
+  logger.info('Video censorship status has been updated', {id: videoId, isCensored: isCensored.isTrue})
 }
 
 // eslint-disable-next-line @typescript-eslint/naming-convention

+ 0 - 26
query-node/mappings/src/storage.ts

@@ -89,32 +89,6 @@ export async function data_directory_ContentAccepted(db: DatabaseManager, event:
   logger.info("Storage content has been accepted", {id: contentId})
 }
 
-export async function data_directory_ContentRejected(db: DatabaseManager, event: SubstrateEvent): Promise<void> {
-  // read event data
-  const {contentId, storageProviderId} = new DataDirectory.ContentRejectedEvent(event).data
-
-  // load asset
-  const dataObject = await db.get(DataObject, { where: { joystreamContentId: contentId }})
-
-  // ensure object exists
-  if (!dataObject) {
-    return inconsistentState('Non-existing content rejection requested', contentId)
-  }
-
-  // update object
-  dataObject.liaisonId = storageProviderId
-  dataObject.liaisonJudgement = LiaisonJudgement.REJECTED
-
-  // set last update time
-  dataObject.updatedAt = new Date(event.blockTimestamp.toNumber())
-
-  // save object
-  await db.save<DataObject>(dataObject)
-
-  // emit log event
-  logger.info("Storage content has been rejected", {id: contentId})
-}
-
 /////////////////// Helpers ////////////////////////////////////////////////////
 
 function convertStorageObjectOwner(objectOwner: StorageObjectOwner): typeof DataObjectOwner {

+ 0 - 3
query-node/schema.graphql

@@ -73,9 +73,6 @@ enum LiaisonJudgement {
 
   "Content accepted"
   ACCEPTED,
-
-  "Content rejected"
-  REJECTED,
 }
 
 "Manages content ids, type and storage provider decision about it"

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 386 - 489
yarn.lock


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov