graphql added can_update field, activated REST node patch

This commit is contained in:
Bachir Soussi Chiadmi 2024-03-18 18:56:12 +01:00
parent fd50407980
commit 7819ebcf32
3 changed files with 72 additions and 20 deletions

View File

@ -0,0 +1,19 @@
uuid: 2440a352-f464-4f5e-b230-247dd83e6602
langcode: fr
status: true
dependencies:
module:
- node
- serialization
- user
id: entity.node
plugin_id: 'entity:node'
granularity: resource
configuration:
methods:
- POST
- PATCH
formats:
- json
authentication:
- cookie

View File

@ -5,18 +5,23 @@ interface NodeInterface {
path: String!
created: String
changed: String
uuid: String!
bundle: String!
can_update: Boolean
}
type Concernement implements NodeInterface {
id: Int!
revision_id: Int!
path: String!
uuid: String!
bundle: String!
title: String!
author: User
created: String
changed: String
uuid: String!
bundle: String!
can_update: Boolean
#
revision_id: Int!
title: String!
author: User
lieu: [Taxoterm]
description: String
caillou: String
@ -38,12 +43,14 @@ type Entiteintegre {
type Entite implements NodeInterface {
id: Int!
path: String!
uuid: String!
bundle: String!
title: String!
author: User
created: String
changed: String
uuid: String!
bundle: String!
can_update: Boolean
#
title: String!
author: User
action: String
menacemaintien: String
superposition: [Entite]
@ -68,9 +75,13 @@ type Source {
type Besoin implements NodeInterface {
id: Int!
path: String!
author: String
created: String
changed: String
uuid: String!
bundle: String!
can_update: Boolean
#
author: String
description: String!
index: Int
concernement: Concernement
@ -80,9 +91,13 @@ type Besoin implements NodeInterface {
type Reponse implements NodeInterface {
id: Int!
path: String!
author: String
created: String
changed: String
uuid: String!
bundle: String!
can_update: Boolean
#
author: String
besoin: Besoin
qui: String
quoi: String
@ -93,12 +108,14 @@ type Reponse implements NodeInterface {
type Doleance implements NodeInterface {
id: Int!
path: String!
uuid: String!
bundle: String!
title: String!
author: String
created: String
changed: String
uuid: String!
bundle: String!
can_update: Boolean
#
title: String!
author: String
#1
date_leprobleme: Date
leprobleme: String
@ -157,13 +174,15 @@ type ReceptionsApplications {
type Static implements NodeInterface {
id: Int!
uuid: String!
bundle: String!
title: String!
path: String!
author: String
created: String
changed: String
uuid: String!
bundle: String!
can_update: Boolean
#
title: String!
author: String
promoted: Boolean
texte: String
}

View File

@ -310,7 +310,21 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
})
)
);
// editable: Boolean
$registry->addFieldResolver('Concernement', 'can_update',
$builder->compose(
$builder->callback(function(/** @var Drupal\node\Entity\node */ $parent, $arg){
$t="t";
// $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$user = \Drupal::currentUser();
$can_update = $parent->access('update', $user);
return $can_update;
})
)
);
}
// _____ _ _ _ __ ___ _ __ __