Giter VIP home page Giter VIP logo

Comments (8)

yatishTrootech avatar yatishTrootech commented on July 26, 2024

Response of comment field in post detail API:

  • Current
[
  "comments": [
          {
              "id": 72,
              "content": "zjsjsi",
              "created_by": 25,
              "created_on": "2023-04-03 12:28:56",
              "modified_by": 25,
              "modified_on": "2023-04-06T04:11:38",
              "post": 104,
              "commented_by_user_info": {
                  "pk": 25,
                  "first_name": "Jeet",
                  "last_name": "saini",
                  "departments": [
                      {
                          "name": "nuhs parent dept 2"
                      }
                  ],
                  "profile_img": "/static/img/profile_img.png",
                  "full_name": "Jeet saini"
              },
              "reaction_types": [
                  0
              ],
              "liked_count": 1,
              "liked_by": [
                  {
                      "user_info": {
                          "pk": 25,
                          "email": "[email protected]",
                          "first_name": "Jeet",
                          "last_name": "saini",
                          "departments": [
                              {
                                  "name": "nuhs parent dept 2"
                              }
                          ],
                          "profile_img": "/static/img/profile_img.png",
                          "full_name": "Jeet saini"
                      },
                      "created_on": "2023-04-03"
                  }
              ],
              "has_liked": false,
              "tagged_users": [],
              "images": [],
              "documents": []
          }
      ],
 ]

  • New Response would be:
{
  "comments": {
    "count": 10,
    "next": "http://localhost:8000/api/comments/?page=1",
    "previous": null,
    "results": [
      {
        "id": 72,
        "content": "zjsjsi",
        "created_by": 25,
        "created_on": "2023-04-03 12:28:56",
        "modified_by": 25,
        "modified_on": "2023-04-06T04:11:38",
        "post": 104,
        "commented_by_user_info": {
          "pk": 25,
          "first_name": "Jeet",
          "last_name": "saini",
          "departments": [
            {
              "name": "nuhs parent dept 2"
            }
          ],
          "profile_img": "/static/img/profile_img.png",
          "full_name": "Jeet saini"
        },
        "reaction_types": [
          0
        ],
        "liked_count": 1,
        "liked_by": [
          {
            "user_info": {
              "pk": 25,
              "email": "[email protected]",
              "first_name": "Jeet",
              "last_name": "saini",
              "departments": [
                {
                  "name": "nuhs parent dept 2"
                }
              ],
              "profile_img": "/static/img/profile_img.png",
              "full_name": "Jeet saini"
            },
            "created_on": "2023-04-03"
          }
        ],
        "has_liked": false,
        "tagged_users": [
          
        ],
        "images": [
          
        ],
        "documents": [
          
        ]
      }
    ],
    
  }
}

This new response might break existing calls of API which were using comments field from this API

Current "comments": [] (list)
New "comments": {} (dict)

@suryaiiit

from feeds.

suryaiiit avatar suryaiiit commented on July 26, 2024

Then we don’t do this change … old app should not break, anyways you can think off .. to support old app, as well as new apps?

from feeds.

yatishTrootech avatar yatishTrootech commented on July 26, 2024

Then we don’t do this change … old app should not break, anyways you can think off .. to support old app, as well as new apps?

On the basis of the version we can make this change for older versions I will pass the response as previous otherwise paginated for new apps

from feeds.

suryaiiit avatar suryaiiit commented on July 26, 2024

Sounds fine, please go ahead

please provide details on what version and key for the same.

from feeds.

yatishTrootech avatar yatishTrootech commented on July 26, 2024

Sounds fine, please go ahead

please provide details on what version and key for the same.

Ok I will ask this with frontend person what version it should be

from feeds.

yatishTrootech avatar yatishTrootech commented on July 26, 2024

@smitakadia @Puneeth-kb @suryaiiit @apriyae for version v>12 it will return paginated response

{{url}}/feeds/api/posts/104/

  • Add count of likes field > appreciation_count
  • Add count of comments > comments_count
  • Paginated response for like > appreciated_by
  • Paginated response for comments > comments
{
    "id": 104,
    "created_by": 12659,
    "created_on": "2020-11-09",
    "modified_by": 8887,
    "modified_on": "2020-11-09",
    "organizations": [
        1
    ],
    "created_by_user_info": {
        "pk": 12659,
        "email": "[email protected]",
        "first_name": "prashant",
        "last_name": "bhaiya",
        "departments": [
            {
                "name": "Finance"
            }
        ],
        "profile_img": null,
        "full_name": "prashant bhaiya"
    },
    "title": "test",
    "description": null,
    "post_type": 2,
    "poll_info": {
        "id": 104,
        "question": "test",
        "answers": [
            {
                "id": 42,
                "question": 104,
                "answer_text": "one",
                "votes": 0,
                "has_voted": false,
                "percentage": null,
                "voters_info": [],
                "is_winner": false
            },
            {
                "id": 43,
                "question": 104,
                "answer_text": "two",
                "votes": 0,
                "has_voted": false,
                "percentage": null,
                "voters_info": [],
                "is_winner": false
            }
        ],
        "is_poll_active": false,
        "poll_remaining_time": null,
        "user_has_voted": false,
        "total_votes": 0,
        "active_days": 30
    },
    "active_days": 30,
    "priority": false,
    "prior_till": null,
    "shared_with": 20,
    "images": null,
    "documents": null,
    "videos": null,
    "is_owner": false,
    "can_edit": false,
    "can_delete": true,
    "has_appreciated": false,
    "appreciation_count": 38,
    "appreciated_by": {
        "count": 38,
        "next": "http://localhost:8000/feeds/api/posts/104/post_appreciations/?page=2",
        "previous": null,
        "results": [
            {
                "user_info": {
                    "pk": 12659,
                    "email": "[email protected]",
                    "first_name": "prashant",
                    "last_name": "bhaiya",
                    "departments": [
                        {
                            "name": "Finance"
                        }
                    ],
                    "profile_img": "/static/img/profile_img.png",
                    "full_name": "prashant bhaiya"
                },
                "created_on": "2023-03-31",
                "reaction_type": 0
            }
        ]
    },
    "comments_count": 60,
    "comments": {
        "count": 60,
        "next": "http://localhost:8000/feeds/api/posts/104/comments/?page=2",
        "previous": null,
        "results": [
            {
                "id": 1,
                "content": "why is it reported?",
                "created_by": 12659,
                "created_on": "2020-10-22 10:39:24",
                "modified_by": 620,
                "modified_on": "2020-10-22T10:39:24",
                "post": 104,
                "commented_by_user_info": {
                    "pk": 12659,
                    "first_name": "prashant",
                    "last_name": "bhaiya",
                    "departments": [
                        {
                            "name": "Finance"
                        }
                    ],
                    "profile_img": "/static/img/profile_img.png",
                    "full_name": "prashant bhaiya"
                },
                "reaction_types": [
                    0
                ],
                "liked_count": 1,
                "liked_by": [
                    {
                        "user_info": {
                            "pk": 620,
                            "email": "[email protected]",
                            "first_name": "AIGG",
                            "last_name": "BANGALORE",
                            "departments": [
                                {
                                    "name": "Abc"
                                }
                            ],
                            "profile_img": null,
                            "full_name": "AIGG BANGALORE"
                        },
                        "created_on": "2020-10-22"
                    }
                ],
                "has_liked": false,
                "tagged_users": [],
                "images": [],
                "documents": []
            }
        ]
    },
    "tagged_users": [],
    "is_admin": true,
    "nomination": {
        "category": null,
        "comment": "",
        "user_strength": {
            "name": "",
            "illustration": null,
            "background_color": "",
            "message": "",
            "icon": null,
            "background_color_lite": ""
        },
        "nominated_team_member": {
            "email": "",
            "first_name": "",
            "last_name": ""
        },
        "message_to_reviewer": ""
    },
    "feed_type": 2,
    "user_strength": null,
    "user": {
        "email": "",
        "first_name": "",
        "last_name": ""
    },
    "gif": null,
    "ecard": null,
    "points": "0",
    "user_reaction_type": null,
    "images_with_ecard": [],
    "reaction_type": [
        {
            "reaction_type": 0,
            "reaction_count": 38
        }
    ],
    "category": null,
    "category_name": "",
    "sub_category": null,
    "sub_category_name": "",
    "organization_name": "",
    "display_status": "",
    "department_name": "",
    "departments": [],
    "greeting_info": {
        "day": null,
        "month": null,
        "type": "",
        "thumbnail": "",
        "user_pk": null,
        "user_first_name": "",
        "user_last_name": "",
        "user_email": "",
        "profile_pic": null
    }
}

from feeds.

yatishTrootech avatar yatishTrootech commented on July 26, 2024
<html lang="en">

<head>
    <base href="http://www.example.com/">
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Certificate</title>
</head>

<body >
    <div style="padding: 0;margin: 0;font-size: 1.3em;background: {{background_color}}; height: 100%">

        <div class="certificate-body" style="top: {{top}}; left: {{left}}; position: absolute; transform:translate(-50%, -50%);" >
          <table >
              <tr>
                  <td>  
                    {% if profile_picture %}
                    <div class="profile-section">
                    <img class="user-avatar" src="{{profile_picture}}">
                    </div>
                    {% endif %}
                </td>
                  <td>
                      <div class="user-info">
                        <div class="name font-bold">Presented to – {{user_full_name}}</div>
                        <div class="muted-text">From {{appreciator_full_name}}</div>
                    </div> 
                  </td>
                  <td>
<img style="margin-left: {{org_logo_margin_left}};height:100;width:200" src={{organization_logo}}>

                  </td>
              </tr>
             
          </table> 
          <hr>
          <div class="core-box"  style="background-color: {{core_value_background_color}};">

          <table>
               <tr>
                  <td style="width: 100%">
                      <div class="core-description" style="margin-top:{{description_margin}}">
                        <p  >{{description}}</p>
                </div>
                  </td>
{% if certificate_attachment %}
                  <td>
                      <div class="attachtments">
                        <img src="{{certificate_attachment}}" style="height: 150px;width:150px">
                    </div>
                  </td>
{% endif %}
              </tr>
          </table> 

          <table class="mt-1">
              <tr >
                <td class="left">
                    <strong class="title">{{core_value_name}}</strong>
                </td>
                <td>
                  {% if points %}
                    <div class="points-details rigth" style="margin-left: {{point_details_margin_left}};">
                      <img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAQCAYAAAAI0W+oAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMnSURBVHgBlVPdThNBFD6zu8U2+NMGYzRq3PICrk9gfQLhAYjdBKNcCNTE67JPUNALMcQULgx6JT4B5QUMPAFFQRREltDA2t05xzOz3bKIqEyyO2fOnPN9528ATlmH87Yt3/VX4T+Wsg3n7dLfbIzTLkyAqpRUprqdT+vl2/7a7zoTsEoE1TMTHdav2lJK/sgNLBw70nOWiOPtHhhP2xICEGHj8M3N8pmI0DSrUUhebqjZYABnt57XGRg9KnJiVBzrZmVZdWwb3kHbmKKIxk4jEuqngPIyd2kf4A4JsA3TuH+hvHEvvrtqq/38OetWGImGdhKg2LwgsqYsiJwL7rrWt+ZujCGiYxIsEEXN0GivFVzf1z57r69UQRhldm4QihUkaIJ52EgMkkAyovc9iyWhQwOV2F6PGZZ6hrZW0pG36tedENA2kBwh6C5yLiSCQe22M3Nl1hC0WBjenlOgBuQe8DDYXHqbER1DCJsYW3AuqnJxRqBlVRO2abJNE4EaCOaHgruxvPkyb2etTD0rrHJueHNNJJHsvLpc4+74fY9+eCpLhp1QgDFusisGzpmE0HfECkVH+kodZtEIKkEAXAGrbpLlFka+Nrs9Stb36b7JMJQL1574jd0ZRUYTmkUb8kkTKBfUcqdfnW6L2cLwlqvE7em+xYike23Eb8Kfpo5HejeRCw+3PEnk8TjzkCGoHUntkj8SSu6cSUrskmgctkmTnCRCWQoiWFby59r5UusgmmS0WU2S+njkKXVeuvx4x/32vPd2goNS+qu1/LFHbR3PCMGKQudTLVcVPA0ZGVYkZnTp4jIjdKqtC9rpkwYN2XZ9spdCak/JCNcsIIftGieIlDHizxIxgcm9uTHaWlL6Ly8uDkBCFa+EVw2CEpxiZV89hfJqLWsDZSYk4G1SzyRFJI6IIA9R1ik+C7qX67Veh4v7UYFSnMEuoy8xyED8lOLRCNEqFCtH7y4mjG4Vn0ZLJ3pUrICfJgENIB3deEQ/QvJCmem/PtoaDDEq8tzNJUMCsl1K+xUrQTNNcqx0pyybSTwwspNxxAddIN5cjtzjaagCGf4/cOAXICnvajkxR+4AAAAASUVORK5CYII='/>
                        <strong  class="title" style="font-size:18px">{{points}} Points</strong>
                    </div>
                  {% endif %}
                </td>
              </tr>
           </table>
       </div>
        </div>  
   </div>
</body>

</html>


<style>
  body{padding: 0;margin: 0;}

      .certificate-body{
          padding: 1.5em;
          border-radius: 17px;
          background-color: #fff;
          width: 55%;
      }
      .mt-1{ margin-top: 0.5rem;}
      .mt-2{ margin-top: 1rem;}
      .mt-3{ margin-top: 1.5rem;}
      .mt-4{ margin-top: 2rem;}
      .profile-section{ margin-right:10px; }
      .user-avatar{height: 65px;border-radius: 12px;}
      .muted-text{ color: grey; font-size: 16px; font-weight: 700;}
      .text-center{text-align: center;}
      .name{ font-size:18px }
      .user-avatar{height: 65px;border-radius: 12px;}
      .font-bold{font-weight: bold;}
      .core-box{padding: 1.5rem 1.5rem; border-radius: 12px }
      .logo{position: absolute; top :0;right: 85px; }
      .title{ font-size:30px; font-weight:700;}
      .core-icon img{height: 60px;}
      .attachtments{text-align: center;margin-left: 10px;}
      .points-details{ display: flex;align-items: center;}
      .user-info{width: 480px}
      .left{float: left; width: 550px}
      .right{position: absolute; right: 32px;}
</style>

from feeds.

Revanthsanaboyina avatar Revanthsanaboyina commented on July 26, 2024

PASS

Date: 28-04-2023
server: tom.skordev.com
user: [email protected]

Hi @yatishTrootech Above features are working fine.

@apriyae

from feeds.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.