Generate new AccessToken each time user update his Information

im building a PWA app , where i implemented jwt token to auth users.

i have 2 main architecture problems ,but let me introduce you what im building .

i’m Building application that is all about dog lovers , this application is to post lost dogs, post dogs for an adoption , for dog owners to find a good dog services around them like vets and dog walkers etc

in my application you are registering with Facebook or Google,

in my application any user can open up services , if you are a dog walker you can easily open up a service fill in some basic stuff and people all around can find this new service .

i got [ auth , user , chat , association , dog , haircut, review , store , trainer , vet ,walker ] = micro services

i am planing to run it on Aws Ecs.

1st problem : JTW stay Outdated if i dont talk to Auth service and Re generate token for a user .

if user register new vet service, i must return him also a new access Token , or else his JWT token will be outdated with his old information that will not has that information about the newly created service.

right now im letting the micro services to talk between them and i really dont like this idea because i can easily get lost with debugging and logging them.

this is how creating new service look now

*each microservice holds in his ENV the key to read the JWT

User >

walkerService (creating new service) userService (updating User property “services” field with the new services pointer id) user object has “services” object inside , its has arrays that hold pointers to serviceDb authService (generating new updated access Token)

so what now ? each time user will do update or create service i should return new JWT ?

i can fix it using API GATEWAY , but …

2nd problem

if i create an api micro service, Api gateway , and move some of the logic into there i feel like im back into a monolith app , in api gateway i can do all stuff related to auth and actually remove the auth service at all , i can “bypass” the problem of direct talk between micro services because i can await for each micro service to finish his task before continue to the next task of the next micro service .

but then the api gateway become more logical and less simple like he should be with just auth , some throttle and routing around micro services…

For example , When in front end if you are watch a post of adoption ,

you actually looking at a document from the “dog” services , but , there also a field of owner (giving private name of the person who actually post this),

in the dog document i have for example the owner id

“dh83db34u9f” : { ownerId: “d236d8g2d83d4”, dogName: “Maya”, dogAge: “Etc..” }

so , before i return this document from the dog service , i also need to attach it the name of the owner so i need to ask from the “user” the public info for this user

and only then , combine this 2 into 1 object and Response to the Call…

i believe this api gateway shouldn’t do stuff like that , so i wonder should i create new service just for “crud” / “actions” ?

What is the safe way to update production data if data found inconsistent

I am in a small company and require to fix a bunch of data in production which are inconsistent. I have written the script to handle the fix.

I understand that writing sql to fix data is way more risky than working on fixes normal front end or backend code. For front end or back end, we can write thousands of test code to automatically test result or even little bug the affect might not be as dramatic.

How do you guys fix the data in production normally if many data was inconsistent? Are there any method or strategy which can reduce the risk

Update post meta not working in transition_post_status

I am developing a plugin for custom post type which take the link from the title of the post and then after scraping on that link it updates all things like post title, post permalink and post_meta. Now its only updating the title and the link but not the post meta, I have tried debugging the data.

function a_new_post($  new_status, $  old_status, $  post) {      if ('publish' !== $  new_status or 'publish' === $  old_status)         return;     $  new_slug = sanitize_title($  post->post_title);     if ('aps-products' !== $  post->post_type)         return; // restrict the filter to a specific post type      $  result= getSpecs($  post->post_title);  /* ****************************************************************************** ****************************************************************************** ****************************************************************************** */ $  groups = get_aps_cat_groups(16); $  groups_data = get_aps_groups_data(); $  attrs_data = get_aps_attributes_data();  // get aps attributes data from input fields  foreach ($  groups as $  groupId) {     $  group_data = $  groups_data[$  groupId];     $  group_values = get_aps_product_attributes($  post->ID, $  groupId);      if ($  group_data['attrs']) {         if (aps_is_array($  group_data['attrs'])) {             $  first=array();             $  value='';             foreach ($  group_data['attrs'] as $  attr_id) {                 switch($  attr_id){                     case 20:                         $  value=$  result[1];                     break;                     case 21:                         $  value=$  result[12];                     break;                     case 22:                         $  value=$  result[3];                     break;                     case 24:                         $  value=$  result[13];                     break;                 }                 $  frist[$  attr_id]=$  value;             }             update_post_meta( $  post->ID, 'aps-attr-group-' .$  groupId, $  first );         }     } }    /* ****************************************************************************** ****************************************************************************** ****************************************************************************** */      $  post_update = array(         'ID'         => $  post->ID,         'post_title' => $  result[0].' '.$  result[1]     );     if (!wp_is_post_revision($  post->ID)) {         wp_update_post($  post_update);         $  new_slug = sanitize_title($  result[0].' '.$  result[1]);         if ($  post->post_name != $  new_slug) {             wp_update_post(                 array(                     'ID'        => $  post->ID,                     'post_name' => $  new_slug                  )             );         }     } } 

update matching column value in anywhere in database sqlserver

I have assetid column in multiple table in my Database and Asset(main) table

I want to update all occurences of tables in all occurences of inserts in database assetid column where value has 1020 to 1

update AdminInterests set assetid = 1 where 1020 

I just want to how to apply this update for entire database all tables with one query