Changeset 8f1b7e9 in Git


Ignore:
Timestamp:
02/10/22 13:28:00 (3 years ago)
Author:
Test <matonikolov77@…>
Branches:
main
Children:
980eeda
Parents:
6f91f99
Message:

Changed DiscussionRepository and DiscussionServiceImpl for fetching likes

Files:
43 edited

Legend:

Unmodified
Added
Removed
  • .idea/dataSources/14a5fbd7-f501-41df-a0af-e3b168b536f7.xml

    r6f91f99 r8f1b7e9  
    45314531209758||209757|C|G
    45324532209758||209757|T|G
    4533 217893||17780|c|G
    4534 217893||18298|c|G
    4535 217893||17780|C|G
    4536 217893||17780|T|G</Grants>
    4537       <IntrospectionStateNumber>147246</IntrospectionStateNumber>
     4533221486||17780|c|G
     4534221486||18298|c|G
     4535221486||17780|C|G
     4536221486||17780|T|G</Grants>
     4537      <IntrospectionStateNumber>148616</IntrospectionStateNumber>
    45384538      <ServerVersion>14.1</ServerVersion>
    45394539      <StartupTime>1642285030</StartupTime>
     
    81408140    </database>
    81418141    <database id="558" parent="1" name="db_201920z_va_vezhbi">
    8142       <ObjectId>217893</ObjectId>
     8142      <ObjectId>221486</ObjectId>
    81438143      <OwnerName>db_201920z_va_vezhbi_owner</OwnerName>
    81448144    </database>
     
    1502115021    <role id="2184" parent="1" name="db_201920z_va_vezhbi">
    1502215022      <Inherit>0</Inherit>
    15023       <ObjectId>217892</ObjectId>
     15023      <ObjectId>221485</ObjectId>
    1502415024    </role>
    1502515025    <role id="2185" parent="1" name="db_201920z_va_vezhbi_owner">
     
    1994519945    </schema>
    1994619946    <schema id="3245" parent="623" name="project">
    19947       <IntrospectionStateNumber>147247</IntrospectionStateNumber>
     19947      <IntrospectionStateNumber>148617</IntrospectionStateNumber>
    1994819948      <ObjectId>152130</ObjectId>
    1994919949      <StateNumber>137939</StateNumber>
     
    2001420014      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2001520015    </sequence>
    20016     <table id="3255" parent="3245" name="discussions">
     20016    <table id="3255" parent="3245" name="discussion_likes">
     20017      <ObjectId>219894</ObjectId>
     20018      <StateNumber>147785</StateNumber>
     20019      <AccessMethodId>2</AccessMethodId>
     20020      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
     20021    </table>
     20022    <table id="3256" parent="3245" name="discussions">
    2001720023      <ObjectId>157244</ObjectId>
    2001820024      <StateNumber>138394</StateNumber>
     
    2002020026      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2002120027    </table>
    20022     <table id="3256" parent="3245" name="genres">
     20028    <table id="3257" parent="3245" name="genres">
    2002320029      <ObjectId>157142</ObjectId>
    2002420030      <StateNumber>138394</StateNumber>
     
    2002620032      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2002720033    </table>
    20028     <table id="3257" parent="3245" name="movie_actors">
     20034    <table id="3258" parent="3245" name="movie_actors">
    2002920035      <ObjectId>157211</ObjectId>
    2003020036      <StateNumber>138394</StateNumber>
     
    2003220038      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2003320039    </table>
    20034     <table id="3258" parent="3245" name="movie_genres">
     20040    <table id="3259" parent="3245" name="movie_genres">
    2003520041      <ObjectId>157181</ObjectId>
    2003620042      <StateNumber>138394</StateNumber>
     
    2003820044      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2003920045    </table>
    20040     <table id="3259" parent="3245" name="movie_likes">
     20046    <table id="3260" parent="3245" name="movie_likes">
    2004120047      <ObjectId>157166</ObjectId>
    2004220048      <StateNumber>138394</StateNumber>
     
    2004420050      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2004520051    </table>
    20046     <table id="3260" parent="3245" name="movie_rates">
     20052    <table id="3261" parent="3245" name="movie_rates">
    2004720053      <ObjectId>157150</ObjectId>
    2004820054      <StateNumber>138394</StateNumber>
     
    2005020056      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2005120057    </table>
    20052     <table id="3261" parent="3245" name="movies">
     20058    <table id="3262" parent="3245" name="movies">
    2005320059      <ObjectId>157125</ObjectId>
    2005420060      <StateNumber>138394</StateNumber>
     
    2005620062      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2005720063    </table>
    20058     <table id="3262" parent="3245" name="person_rates">
     20064    <table id="3263" parent="3245" name="person_rates">
    2005920065      <ObjectId>157227</ObjectId>
    2006020066      <StateNumber>138394</StateNumber>
     
    2006220068      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2006320069    </table>
    20064     <table id="3263" parent="3245" name="persons">
     20070    <table id="3264" parent="3245" name="persons">
    2006520071      <ObjectId>157115</ObjectId>
    2006620072      <StateNumber>139960</StateNumber>
     
    2006820074      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2006920075    </table>
    20070     <table id="3264" parent="3245" name="replies">
     20076    <table id="3265" parent="3245" name="replies">
    2007120077      <ObjectId>157269</ObjectId>
    2007220078      <StateNumber>138394</StateNumber>
     
    2007420080      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2007520081    </table>
    20076     <table id="3265" parent="3245" name="user_genres">
     20082    <table id="3266" parent="3245" name="user_genres">
    2007720083      <ObjectId>157196</ObjectId>
    2007820084      <StateNumber>138394</StateNumber>
     
    2008020086      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2008120087    </table>
    20082     <table id="3266" parent="3245" name="users">
     20088    <table id="3267" parent="3245" name="users">
    2008320089      <ObjectId>157103</ObjectId>
    2008420090      <StateNumber>141874</StateNumber>
     
    2008620092      <OwnerName>db_202122z_va_prj_wediscussmovies_owner</OwnerName>
    2008720093    </table>
    20088     <argument id="3267" parent="3247">
     20094    <argument id="3268" parent="3247">
    2008920095      <ArgumentDirection>R</ArgumentDirection>
    2009020096      <DataType>char|0s</DataType>
    2009120097    </argument>
    20092     <argument id="3268" parent="3247">
     20098    <argument id="3269" parent="3247">
    2009320099      <DataType>integer|0s</DataType>
    2009420100      <Position>1</Position>
    2009520101    </argument>
    20096     <argument id="3269" parent="3248">
     20102    <argument id="3270" parent="3248">
    2009720103      <ArgumentDirection>R</ArgumentDirection>
    2009820104      <DataType>char|0s</DataType>
    2009920105    </argument>
    20100     <argument id="3270" parent="3248">
     20106    <argument id="3271" parent="3248">
    2010120107      <DataType>integer|0s</DataType>
    2010220108      <Position>1</Position>
    2010320109    </argument>
    20104     <check id="3271" parent="3255" name="ck_type_discussion">
     20110    <column id="3272" parent="3255" name="discussion_id">
     20111      <DataType>integer|0s</DataType>
     20112      <NotNull>1</NotNull>
     20113      <Position>1</Position>
     20114      <StateNumber>147785</StateNumber>
     20115      <TypeId>23</TypeId>
     20116    </column>
     20117    <column id="3273" parent="3255" name="user_id">
     20118      <DataType>integer|0s</DataType>
     20119      <NotNull>1</NotNull>
     20120      <Position>2</Position>
     20121      <StateNumber>147785</StateNumber>
     20122      <TypeId>23</TypeId>
     20123    </column>
     20124    <foreign-key id="3274" parent="3255" name="fk_liked_discussion">
     20125      <ColNames>discussion_id</ColNames>
     20126      <ObjectId>219899</ObjectId>
     20127      <OnDelete>cascade</OnDelete>
     20128      <OnUpdate>cascade</OnUpdate>
     20129      <RefColNames>discussion_id</RefColNames>
     20130      <RefColPositions>1</RefColPositions>
     20131      <RefKeyName>discussions_pkey</RefKeyName>
     20132      <StateNumber>147785</StateNumber>
     20133      <RefTableId>157244</RefTableId>
     20134      <RefTableName>discussions</RefTableName>
     20135      <RefTableKind>table</RefTableKind>
     20136    </foreign-key>
     20137    <foreign-key id="3275" parent="3255" name="fk_user_like">
     20138      <ColNames>user_id</ColNames>
     20139      <ObjectId>219904</ObjectId>
     20140      <OnDelete>cascade</OnDelete>
     20141      <OnUpdate>cascade</OnUpdate>
     20142      <RefColNames>user_id</RefColNames>
     20143      <RefColPositions>1</RefColPositions>
     20144      <RefKeyName>users_pkey</RefKeyName>
     20145      <StateNumber>147785</StateNumber>
     20146      <RefTableId>157103</RefTableId>
     20147      <RefTableName>users</RefTableName>
     20148      <RefTableKind>table</RefTableKind>
     20149    </foreign-key>
     20150    <index id="3276" parent="3255" name="pk_discussion_likes">
     20151      <ClassIds>1978,1978</ClassIds>
     20152      <ColNames>discussion_id
     20153user_id</ColNames>
     20154      <CollationIds>0,0</CollationIds>
     20155      <ObjectId>219897</ObjectId>
     20156      <Primary>1</Primary>
     20157      <StateNumber>147785</StateNumber>
     20158      <Unique>1</Unique>
     20159      <AccessMethodId>403</AccessMethodId>
     20160    </index>
     20161    <key id="3277" parent="3255" name="pk_discussion_likes">
     20162      <ColNames>discussion_id
     20163user_id</ColNames>
     20164      <ObjectId>219898</ObjectId>
     20165      <Primary>1</Primary>
     20166      <StateNumber>147785</StateNumber>
     20167      <UnderlyingIndexId>219897</UnderlyingIndexId>
     20168    </key>
     20169    <check id="3278" parent="3256" name="ck_type_discussion">
    2010520170      <ColNames>type
    2010620171movie_id
     
    2011020175      <StateNumber>138394</StateNumber>
    2011120176    </check>
    20112     <column id="3272" parent="3255" name="discussion_id">
     20177    <column id="3279" parent="3256" name="discussion_id">
    2011320178      <DataType>integer|0s</DataType>
    2011420179      <DefaultExpression>nextval(&apos;project.discussions_discussion_id_seq&apos;::regclass)</DefaultExpression>
     
    2011820183      <TypeId>23</TypeId>
    2011920184    </column>
    20120     <column id="3273" parent="3255" name="type">
     20185    <column id="3280" parent="3256" name="type">
    2012120186      <DataType>char|0s</DataType>
    2012220187      <NotNull>1</NotNull>
     
    2012520190      <TypeId>1042</TypeId>
    2012620191    </column>
    20127     <column id="3274" parent="3255" name="text">
     20192    <column id="3281" parent="3256" name="text">
    2012820193      <DataType>varchar(1000)|0s</DataType>
    2012920194      <NotNull>1</NotNull>
     
    2013220197      <TypeId>1043</TypeId>
    2013320198    </column>
    20134     <column id="3275" parent="3255" name="title">
     20199    <column id="3282" parent="3256" name="title">
    2013520200      <DataType>varchar(250)|0s</DataType>
    2013620201      <NotNull>1</NotNull>
     
    2013920204      <TypeId>1043</TypeId>
    2014020205    </column>
    20141     <column id="3276" parent="3255" name="date">
     20206    <column id="3283" parent="3256" name="date">
    2014220207      <DataType>date|0s</DataType>
    2014320208      <NotNull>1</NotNull>
     
    2014620211      <TypeId>1082</TypeId>
    2014720212    </column>
    20148     <column id="3277" parent="3255" name="user_id">
     20213    <column id="3284" parent="3256" name="user_id">
    2014920214      <DataType>integer|0s</DataType>
    2015020215      <NotNull>1</NotNull>
     
    2015320218      <TypeId>23</TypeId>
    2015420219    </column>
    20155     <column id="3278" parent="3255" name="movie_id">
     20220    <column id="3285" parent="3256" name="movie_id">
    2015620221      <DataType>integer|0s</DataType>
    2015720222      <Position>7</Position>
     
    2015920224      <TypeId>23</TypeId>
    2016020225    </column>
    20161     <column id="3279" parent="3255" name="person_id">
     20226    <column id="3286" parent="3256" name="person_id">
    2016220227      <DataType>integer|0s</DataType>
    2016320228      <Position>8</Position>
     
    2016520230      <TypeId>23</TypeId>
    2016620231    </column>
    20167     <foreign-key id="3280" parent="3255" name="fk_user_created">
     20232    <foreign-key id="3287" parent="3256" name="fk_user_created">
    2016820233      <ColNames>user_id</ColNames>
    2016920234      <ObjectId>157253</ObjectId>
     
    2017720242      <RefTableName>users</RefTableName>
    2017820243    </foreign-key>
    20179     <foreign-key id="3281" parent="3255" name="fk_discussion_movie">
     20244    <foreign-key id="3288" parent="3256" name="fk_discussion_movie">
    2018020245      <ColNames>movie_id</ColNames>
    2018120246      <ObjectId>157258</ObjectId>
     
    2018920254      <RefTableName>movies</RefTableName>
    2019020255    </foreign-key>
    20191     <foreign-key id="3282" parent="3255" name="fk_discussion_person">
     20256    <foreign-key id="3289" parent="3256" name="fk_discussion_person">
    2019220257      <ColNames>person_id</ColNames>
    2019320258      <ObjectId>157263</ObjectId>
     
    2020120266      <RefTableName>persons</RefTableName>
    2020220267    </foreign-key>
    20203     <index id="3283" parent="3255" name="discussions_pkey">
     20268    <index id="3290" parent="3256" name="discussions_pkey">
    2020420269      <ClassIds>1978</ClassIds>
    2020520270      <ColNames>discussion_id</ColNames>
     
    2021220277      <AccessMethodId>403</AccessMethodId>
    2021320278    </index>
    20214     <key id="3284" parent="3255" name="discussions_pkey">
     20279    <key id="3291" parent="3256" name="discussions_pkey">
    2021520280      <ColNames>discussion_id</ColNames>
    2021620281      <NameSurrogate>1</NameSurrogate>
     
    2022020285      <UnderlyingIndexId>157251</UnderlyingIndexId>
    2022120286    </key>
    20222     <column id="3285" parent="3256" name="genre_id">
     20287    <column id="3292" parent="3257" name="genre_id">
    2022320288      <DataType>integer|0s</DataType>
    2022420289      <DefaultExpression>nextval(&apos;project.genres_genre_id_seq&apos;::regclass)</DefaultExpression>
     
    2022820293      <TypeId>23</TypeId>
    2022920294    </column>
    20230     <column id="3286" parent="3256" name="genre_type">
     20295    <column id="3293" parent="3257" name="genre_type">
    2023120296      <DataType>varchar(100)|0s</DataType>
    2023220297      <NotNull>1</NotNull>
     
    2023520300      <TypeId>1043</TypeId>
    2023620301    </column>
    20237     <index id="3287" parent="3256" name="genres_pkey">
     20302    <index id="3294" parent="3257" name="genres_pkey">
    2023820303      <ClassIds>1978</ClassIds>
    2023920304      <ColNames>genre_id</ColNames>
     
    2024620311      <AccessMethodId>403</AccessMethodId>
    2024720312    </index>
    20248     <index id="3288" parent="3256" name="genres_genre_type_key">
     20313    <index id="3295" parent="3257" name="genres_genre_type_key">
    2024920314      <ClassIds>3126</ClassIds>
    2025020315      <ColNames>genre_type</ColNames>
     
    2025720322      <AccessMethodId>403</AccessMethodId>
    2025820323    </index>
    20259     <key id="3289" parent="3256" name="genres_pkey">
     20324    <key id="3296" parent="3257" name="genres_pkey">
    2026020325      <ColNames>genre_id</ColNames>
    2026120326      <NameSurrogate>1</NameSurrogate>
     
    2026520330      <UnderlyingIndexId>157146</UnderlyingIndexId>
    2026620331    </key>
    20267     <key id="3290" parent="3256" name="genres_genre_type_key">
     20332    <key id="3297" parent="3257" name="genres_genre_type_key">
    2026820333      <ColNames>genre_type</ColNames>
    2026920334      <NameSurrogate>1</NameSurrogate>
     
    2027220337      <UnderlyingIndexId>157148</UnderlyingIndexId>
    2027320338    </key>
    20274     <check id="3291" parent="3257" name="ck_person_is_actor">
     20339    <check id="3298" parent="3258" name="ck_person_is_actor">
    2027520340      <ColNames>actor_id</ColNames>
    2027620341      <ObjectId>157214</ObjectId>
     
    2027820343      <StateNumber>138394</StateNumber>
    2027920344    </check>
    20280     <column id="3292" parent="3257" name="movie_id">
     20345    <column id="3299" parent="3258" name="movie_id">
    2028120346      <DataType>integer|0s</DataType>
    2028220347      <NotNull>1</NotNull>
     
    2028520350      <TypeId>23</TypeId>
    2028620351    </column>
    20287     <column id="3293" parent="3257" name="actor_id">
     20352    <column id="3300" parent="3258" name="actor_id">
    2028820353      <DataType>integer|0s</DataType>
    2028920354      <NotNull>1</NotNull>
     
    2029220357      <TypeId>23</TypeId>
    2029320358    </column>
    20294     <foreign-key id="3294" parent="3257" name="fk_actors_in_movie">
     20359    <foreign-key id="3301" parent="3258" name="fk_actors_in_movie">
    2029520360      <ColNames>movie_id</ColNames>
    2029620361      <ObjectId>157217</ObjectId>
     
    2030420369      <RefTableName>movies</RefTableName>
    2030520370    </foreign-key>
    20306     <foreign-key id="3295" parent="3257" name="fk_actor_acts_movie">
     20371    <foreign-key id="3302" parent="3258" name="fk_actor_acts_movie">
    2030720372      <ColNames>actor_id</ColNames>
    2030820373      <ObjectId>157222</ObjectId>
     
    2031620381      <RefTableName>persons</RefTableName>
    2031720382    </foreign-key>
    20318     <index id="3296" parent="3257" name="pk_movie_actors">
     20383    <index id="3303" parent="3258" name="pk_movie_actors">
    2031920384      <ClassIds>1978,1978</ClassIds>
    2032020385      <ColNames>movie_id
     
    2032720392      <AccessMethodId>403</AccessMethodId>
    2032820393    </index>
    20329     <key id="3297" parent="3257" name="pk_movie_actors">
     20394    <key id="3304" parent="3258" name="pk_movie_actors">
    2033020395      <ColNames>movie_id
    2033120396actor_id</ColNames>
     
    2033520400      <UnderlyingIndexId>157215</UnderlyingIndexId>
    2033620401    </key>
    20337     <column id="3298" parent="3258" name="movie_id">
     20402    <column id="3305" parent="3259" name="movie_id">
    2033820403      <DataType>integer|0s</DataType>
    2033920404      <NotNull>1</NotNull>
     
    2034220407      <TypeId>23</TypeId>
    2034320408    </column>
    20344     <column id="3299" parent="3258" name="genre_id">
     20409    <column id="3306" parent="3259" name="genre_id">
    2034520410      <DataType>integer|0s</DataType>
    2034620411      <NotNull>1</NotNull>
     
    2034920414      <TypeId>23</TypeId>
    2035020415    </column>
    20351     <foreign-key id="3300" parent="3258" name="fk_movie_genre">
     20416    <foreign-key id="3307" parent="3259" name="fk_movie_genre">
    2035220417      <ColNames>movie_id</ColNames>
    2035320418      <ObjectId>157186</ObjectId>
     
    2036120426      <RefTableName>movies</RefTableName>
    2036220427    </foreign-key>
    20363     <foreign-key id="3301" parent="3258" name="fk_genre_type_movie">
     20428    <foreign-key id="3308" parent="3259" name="fk_genre_type_movie">
    2036420429      <ColNames>genre_id</ColNames>
    2036520430      <ObjectId>157191</ObjectId>
     
    2037320438      <RefTableName>genres</RefTableName>
    2037420439    </foreign-key>
    20375     <index id="3302" parent="3258" name="pk_movie_genres">
     20440    <index id="3309" parent="3259" name="pk_movie_genres">
    2037620441      <ClassIds>1978,1978</ClassIds>
    2037720442      <ColNames>movie_id
     
    2038420449      <AccessMethodId>403</AccessMethodId>
    2038520450    </index>
    20386     <key id="3303" parent="3258" name="pk_movie_genres">
     20451    <key id="3310" parent="3259" name="pk_movie_genres">
    2038720452      <ColNames>movie_id
    2038820453genre_id</ColNames>
     
    2039220457      <UnderlyingIndexId>157184</UnderlyingIndexId>
    2039320458    </key>
    20394     <column id="3304" parent="3259" name="movie_id">
    20395       <DataType>integer|0s</DataType>
    20396       <NotNull>1</NotNull>
    20397       <Position>1</Position>
    20398       <StateNumber>138394</StateNumber>
    20399       <TypeId>23</TypeId>
    20400     </column>
    20401     <column id="3305" parent="3259" name="user_id">
    20402       <DataType>integer|0s</DataType>
    20403       <NotNull>1</NotNull>
    20404       <Position>2</Position>
    20405       <StateNumber>138394</StateNumber>
    20406       <TypeId>23</TypeId>
    20407     </column>
    20408     <foreign-key id="3306" parent="3259" name="fk_liked_movie">
    20409       <ColNames>movie_id</ColNames>
    20410       <ObjectId>157171</ObjectId>
    20411       <OnDelete>cascade</OnDelete>
    20412       <OnUpdate>cascade</OnUpdate>
    20413       <RefColNames>movie_id</RefColNames>
    20414       <RefColPositions>1</RefColPositions>
    20415       <RefKeyName>movies_pkey</RefKeyName>
    20416       <StateNumber>138394</StateNumber>
    20417       <RefTableId>157125</RefTableId>
    20418       <RefTableName>movies</RefTableName>
    20419     </foreign-key>
    20420     <foreign-key id="3307" parent="3259" name="fk_user_like">
    20421       <ColNames>user_id</ColNames>
    20422       <ObjectId>157176</ObjectId>
    20423       <OnDelete>cascade</OnDelete>
    20424       <OnUpdate>cascade</OnUpdate>
    20425       <RefColNames>user_id</RefColNames>
    20426       <RefColPositions>1</RefColPositions>
    20427       <RefKeyName>users_pkey</RefKeyName>
    20428       <StateNumber>138394</StateNumber>
    20429       <RefTableId>157103</RefTableId>
    20430       <RefTableName>users</RefTableName>
    20431     </foreign-key>
    20432     <index id="3308" parent="3259" name="pk_movie_likes">
    20433       <ClassIds>1978,1978</ClassIds>
    20434       <ColNames>movie_id
    20435 user_id</ColNames>
    20436       <CollationIds>0,0</CollationIds>
    20437       <ObjectId>157169</ObjectId>
    20438       <Primary>1</Primary>
    20439       <StateNumber>138394</StateNumber>
    20440       <Unique>1</Unique>
    20441       <AccessMethodId>403</AccessMethodId>
    20442     </index>
    20443     <key id="3309" parent="3259" name="pk_movie_likes">
    20444       <ColNames>movie_id
    20445 user_id</ColNames>
    20446       <ObjectId>157170</ObjectId>
    20447       <Primary>1</Primary>
    20448       <StateNumber>138394</StateNumber>
    20449       <UnderlyingIndexId>157169</UnderlyingIndexId>
    20450     </key>
    20451     <check id="3310" parent="3260" name="ck_movie_stars">
    20452       <ColNames>stars_rated</ColNames>
    20453       <ObjectId>157153</ObjectId>
    20454       <Predicate>(stars_rated &gt;= 1) AND (stars_rated &lt;= 10)</Predicate>
    20455       <StateNumber>138394</StateNumber>
    20456     </check>
    2045720459    <column id="3311" parent="3260" name="movie_id">
    2045820460      <DataType>integer|0s</DataType>
     
    2046920471      <TypeId>23</TypeId>
    2047020472    </column>
    20471     <column id="3313" parent="3260" name="reason">
     20473    <foreign-key id="3313" parent="3260" name="fk_liked_movie">
     20474      <ColNames>movie_id</ColNames>
     20475      <ObjectId>157171</ObjectId>
     20476      <OnDelete>cascade</OnDelete>
     20477      <OnUpdate>cascade</OnUpdate>
     20478      <RefColNames>movie_id</RefColNames>
     20479      <RefColPositions>1</RefColPositions>
     20480      <RefKeyName>movies_pkey</RefKeyName>
     20481      <StateNumber>138394</StateNumber>
     20482      <RefTableId>157125</RefTableId>
     20483      <RefTableName>movies</RefTableName>
     20484    </foreign-key>
     20485    <foreign-key id="3314" parent="3260" name="fk_user_like">
     20486      <ColNames>user_id</ColNames>
     20487      <ObjectId>157176</ObjectId>
     20488      <OnDelete>cascade</OnDelete>
     20489      <OnUpdate>cascade</OnUpdate>
     20490      <RefColNames>user_id</RefColNames>
     20491      <RefColPositions>1</RefColPositions>
     20492      <RefKeyName>users_pkey</RefKeyName>
     20493      <StateNumber>138394</StateNumber>
     20494      <RefTableId>157103</RefTableId>
     20495      <RefTableName>users</RefTableName>
     20496    </foreign-key>
     20497    <index id="3315" parent="3260" name="pk_movie_likes">
     20498      <ClassIds>1978,1978</ClassIds>
     20499      <ColNames>movie_id
     20500user_id</ColNames>
     20501      <CollationIds>0,0</CollationIds>
     20502      <ObjectId>157169</ObjectId>
     20503      <Primary>1</Primary>
     20504      <StateNumber>138394</StateNumber>
     20505      <Unique>1</Unique>
     20506      <AccessMethodId>403</AccessMethodId>
     20507    </index>
     20508    <key id="3316" parent="3260" name="pk_movie_likes">
     20509      <ColNames>movie_id
     20510user_id</ColNames>
     20511      <ObjectId>157170</ObjectId>
     20512      <Primary>1</Primary>
     20513      <StateNumber>138394</StateNumber>
     20514      <UnderlyingIndexId>157169</UnderlyingIndexId>
     20515    </key>
     20516    <check id="3317" parent="3261" name="ck_movie_stars">
     20517      <ColNames>stars_rated</ColNames>
     20518      <ObjectId>157153</ObjectId>
     20519      <Predicate>(stars_rated &gt;= 1) AND (stars_rated &lt;= 10)</Predicate>
     20520      <StateNumber>138394</StateNumber>
     20521    </check>
     20522    <column id="3318" parent="3261" name="movie_id">
     20523      <DataType>integer|0s</DataType>
     20524      <NotNull>1</NotNull>
     20525      <Position>1</Position>
     20526      <StateNumber>138394</StateNumber>
     20527      <TypeId>23</TypeId>
     20528    </column>
     20529    <column id="3319" parent="3261" name="user_id">
     20530      <DataType>integer|0s</DataType>
     20531      <NotNull>1</NotNull>
     20532      <Position>2</Position>
     20533      <StateNumber>138394</StateNumber>
     20534      <TypeId>23</TypeId>
     20535    </column>
     20536    <column id="3320" parent="3261" name="reason">
    2047220537      <DataType>varchar(300)|0s</DataType>
    2047320538      <NotNull>1</NotNull>
     
    2047620541      <TypeId>1043</TypeId>
    2047720542    </column>
    20478     <column id="3314" parent="3260" name="stars_rated">
     20543    <column id="3321" parent="3261" name="stars_rated">
    2047920544      <DataType>integer|0s</DataType>
    2048020545      <NotNull>1</NotNull>
     
    2048320548      <TypeId>23</TypeId>
    2048420549    </column>
    20485     <foreign-key id="3315" parent="3260" name="fk_rated_movie">
     20550    <foreign-key id="3322" parent="3261" name="fk_rated_movie">
    2048620551      <ColNames>movie_id</ColNames>
    2048720552      <ObjectId>157156</ObjectId>
     
    2049520560      <RefTableName>movies</RefTableName>
    2049620561    </foreign-key>
    20497     <foreign-key id="3316" parent="3260" name="fk_user_rate">
     20562    <foreign-key id="3323" parent="3261" name="fk_user_rate">
    2049820563      <ColNames>user_id</ColNames>
    2049920564      <ObjectId>157161</ObjectId>
     
    2050720572      <RefTableName>users</RefTableName>
    2050820573    </foreign-key>
    20509     <index id="3317" parent="3260" name="pk_movie_rates">
     20574    <index id="3324" parent="3261" name="pk_movie_rates">
    2051020575      <ClassIds>1978,1978</ClassIds>
    2051120576      <ColNames>movie_id
     
    2051820583      <AccessMethodId>403</AccessMethodId>
    2051920584    </index>
    20520     <key id="3318" parent="3260" name="pk_movie_rates">
     20585    <key id="3325" parent="3261" name="pk_movie_rates">
    2052120586      <ColNames>movie_id
    2052220587user_id</ColNames>
     
    2052620591      <UnderlyingIndexId>157154</UnderlyingIndexId>
    2052720592    </key>
    20528     <check id="3319" parent="3261" name="ck_person_is_director">
     20593    <check id="3326" parent="3262" name="ck_person_is_director">
    2052920594      <ColNames>director_id</ColNames>
    2053020595      <ObjectId>157129</ObjectId>
     
    2053220597      <StateNumber>138394</StateNumber>
    2053320598    </check>
    20534     <column id="3320" parent="3261" name="movie_id">
     20599    <column id="3327" parent="3262" name="movie_id">
    2053520600      <DataType>integer|0s</DataType>
    2053620601      <DefaultExpression>nextval(&apos;project.movies_movie_id_seq&apos;::regclass)</DefaultExpression>
     
    2054020605      <TypeId>23</TypeId>
    2054120606    </column>
    20542     <column id="3321" parent="3261" name="title">
     20607    <column id="3328" parent="3262" name="title">
    2054320608      <DataType>varchar(150)|0s</DataType>
    2054420609      <NotNull>1</NotNull>
     
    2054720612      <TypeId>1043</TypeId>
    2054820613    </column>
    20549     <column id="3322" parent="3261" name="description">
     20614    <column id="3329" parent="3262" name="description">
    2055020615      <DataType>varchar(1000)|0s</DataType>
    2055120616      <NotNull>1</NotNull>
     
    2055420619      <TypeId>1043</TypeId>
    2055520620    </column>
    20556     <column id="3323" parent="3261" name="image_url">
     20621    <column id="3330" parent="3262" name="image_url">
    2055720622      <DataType>varchar(300)|0s</DataType>
    2055820623      <NotNull>1</NotNull>
     
    2056120626      <TypeId>1043</TypeId>
    2056220627    </column>
    20563     <column id="3324" parent="3261" name="airing_date">
     20628    <column id="3331" parent="3262" name="airing_date">
    2056420629      <DataType>date|0s</DataType>
    2056520630      <NotNull>1</NotNull>
     
    2056820633      <TypeId>1082</TypeId>
    2056920634    </column>
    20570     <column id="3325" parent="3261" name="imdb_rating">
     20635    <column id="3332" parent="3262" name="imdb_rating">
    2057120636      <DataType>double precision|0s</DataType>
    2057220637      <Position>6</Position>
     
    2057420639      <TypeId>701</TypeId>
    2057520640    </column>
    20576     <column id="3326" parent="3261" name="director_id">
     20641    <column id="3333" parent="3262" name="director_id">
    2057720642      <DataType>integer|0s</DataType>
    2057820643      <Position>7</Position>
     
    2058020645      <TypeId>23</TypeId>
    2058120646    </column>
    20582     <foreign-key id="3327" parent="3261" name="fk_movie_director">
     20647    <foreign-key id="3334" parent="3262" name="fk_movie_director">
    2058320648      <ColNames>director_id</ColNames>
    2058420649      <ObjectId>157136</ObjectId>
     
    2059220657      <RefTableName>persons</RefTableName>
    2059320658    </foreign-key>
    20594     <index id="3328" parent="3261" name="movies_pkey">
     20659    <index id="3335" parent="3262" name="movies_pkey">
    2059520660      <ClassIds>1978</ClassIds>
    2059620661      <ColNames>movie_id</ColNames>
     
    2060320668      <AccessMethodId>403</AccessMethodId>
    2060420669    </index>
    20605     <index id="3329" parent="3261" name="movies_title_key">
     20670    <index id="3336" parent="3262" name="movies_title_key">
    2060620671      <ClassIds>3126</ClassIds>
    2060720672      <ColNames>title</ColNames>
     
    2061420679      <AccessMethodId>403</AccessMethodId>
    2061520680    </index>
    20616     <key id="3330" parent="3261" name="movies_pkey">
     20681    <key id="3337" parent="3262" name="movies_pkey">
    2061720682      <ColNames>movie_id</ColNames>
    2061820683      <NameSurrogate>1</NameSurrogate>
     
    2062220687      <UnderlyingIndexId>157132</UnderlyingIndexId>
    2062320688    </key>
    20624     <key id="3331" parent="3261" name="movies_title_key">
     20689    <key id="3338" parent="3262" name="movies_title_key">
    2062520690      <ColNames>title</ColNames>
    2062620691      <NameSurrogate>1</NameSurrogate>
     
    2062920694      <UnderlyingIndexId>157134</UnderlyingIndexId>
    2063020695    </key>
    20631     <check id="3332" parent="3262" name="ck_person_stars">
     20696    <check id="3339" parent="3263" name="ck_person_stars">
    2063220697      <ColNames>stars_rated</ColNames>
    2063320698      <ObjectId>157230</ObjectId>
     
    2063520700      <StateNumber>138394</StateNumber>
    2063620701    </check>
    20637     <column id="3333" parent="3262" name="person_id">
     20702    <column id="3340" parent="3263" name="person_id">
    2063820703      <DataType>integer|0s</DataType>
    2063920704      <NotNull>1</NotNull>
     
    2064220707      <TypeId>23</TypeId>
    2064320708    </column>
    20644     <column id="3334" parent="3262" name="user_id">
     20709    <column id="3341" parent="3263" name="user_id">
    2064520710      <DataType>integer|0s</DataType>
    2064620711      <NotNull>1</NotNull>
     
    2064920714      <TypeId>23</TypeId>
    2065020715    </column>
    20651     <column id="3335" parent="3262" name="reason">
     20716    <column id="3342" parent="3263" name="reason">
    2065220717      <DataType>varchar(300)|0s</DataType>
    2065320718      <NotNull>1</NotNull>
     
    2065620721      <TypeId>1043</TypeId>
    2065720722    </column>
    20658     <column id="3336" parent="3262" name="stars_rated">
     20723    <column id="3343" parent="3263" name="stars_rated">
    2065920724      <DataType>integer|0s</DataType>
    2066020725      <NotNull>1</NotNull>
     
    2066320728      <TypeId>23</TypeId>
    2066420729    </column>
    20665     <foreign-key id="3337" parent="3262" name="fk_rated_person">
     20730    <foreign-key id="3344" parent="3263" name="fk_rated_person">
    2066620731      <ColNames>person_id</ColNames>
    2066720732      <ObjectId>157233</ObjectId>
     
    2067520740      <RefTableName>persons</RefTableName>
    2067620741    </foreign-key>
    20677     <foreign-key id="3338" parent="3262" name="fk_user_rate_person">
     20742    <foreign-key id="3345" parent="3263" name="fk_user_rate_person">
    2067820743      <ColNames>user_id</ColNames>
    2067920744      <ObjectId>157238</ObjectId>
     
    2068720752      <RefTableName>users</RefTableName>
    2068820753    </foreign-key>
    20689     <index id="3339" parent="3262" name="pk_person_rates">
     20754    <index id="3346" parent="3263" name="pk_person_rates">
    2069020755      <ClassIds>1978,1978</ClassIds>
    2069120756      <ColNames>person_id
     
    2069820763      <AccessMethodId>403</AccessMethodId>
    2069920764    </index>
    20700     <key id="3340" parent="3262" name="pk_person_rates">
     20765    <key id="3347" parent="3263" name="pk_person_rates">
    2070120766      <ColNames>person_id
    2070220767user_id</ColNames>
     
    2070620771      <UnderlyingIndexId>157231</UnderlyingIndexId>
    2070720772    </key>
    20708     <check id="3341" parent="3263" name="ck_type">
     20773    <check id="3348" parent="3264" name="ck_type">
    2070920774      <ColNames>type</ColNames>
    2071020775      <ObjectId>157119</ObjectId>
     
    2071220777      <StateNumber>138394</StateNumber>
    2071320778    </check>
    20714     <column id="3342" parent="3263" name="person_id">
     20779    <column id="3349" parent="3264" name="person_id">
    2071520780      <DataType>integer|0s</DataType>
    2071620781      <DefaultExpression>nextval(&apos;project.persons_person_id_seq&apos;::regclass)</DefaultExpression>
     
    2072020785      <TypeId>23</TypeId>
    2072120786    </column>
    20722     <column id="3343" parent="3263" name="name">
     20787    <column id="3350" parent="3264" name="name">
    2072320788      <DataType>varchar(100)|0s</DataType>
    2072420789      <NotNull>1</NotNull>
     
    2072720792      <TypeId>1043</TypeId>
    2072820793    </column>
    20729     <column id="3344" parent="3263" name="surname">
     20794    <column id="3351" parent="3264" name="surname">
    2073020795      <DataType>varchar(100)|0s</DataType>
    2073120796      <NotNull>1</NotNull>
     
    2073420799      <TypeId>1043</TypeId>
    2073520800    </column>
    20736     <column id="3345" parent="3263" name="type">
     20801    <column id="3352" parent="3264" name="type">
    2073720802      <DataType>char|0s</DataType>
    2073820803      <NotNull>1</NotNull>
     
    2074120806      <TypeId>1042</TypeId>
    2074220807    </column>
    20743     <column id="3346" parent="3263" name="date_of_birth">
     20808    <column id="3353" parent="3264" name="date_of_birth">
    2074420809      <DataType>date|0s</DataType>
    2074520810      <NotNull>1</NotNull>
     
    2074820813      <TypeId>1082</TypeId>
    2074920814    </column>
    20750     <column id="3347" parent="3263" name="image_url">
     20815    <column id="3354" parent="3264" name="image_url">
    2075120816      <DataType>varchar(400)|0s</DataType>
    2075220817      <NotNull>1</NotNull>
     
    2075520820      <TypeId>1043</TypeId>
    2075620821    </column>
    20757     <column id="3348" parent="3263" name="description">
     20822    <column id="3355" parent="3264" name="description">
    2075820823      <DataType>varchar(400)|0s</DataType>
    2075920824      <Position>7</Position>
     
    2076120826      <TypeId>1043</TypeId>
    2076220827    </column>
    20763     <index id="3349" parent="3263" name="persons_pkey">
     20828    <index id="3356" parent="3264" name="persons_pkey">
    2076420829      <ClassIds>1978</ClassIds>
    2076520830      <ColNames>person_id</ColNames>
     
    2077220837      <AccessMethodId>403</AccessMethodId>
    2077320838    </index>
    20774     <key id="3350" parent="3263" name="persons_pkey">
     20839    <key id="3357" parent="3264" name="persons_pkey">
    2077520840      <ColNames>person_id</ColNames>
    2077620841      <NameSurrogate>1</NameSurrogate>
     
    2078020845      <UnderlyingIndexId>157122</UnderlyingIndexId>
    2078120846    </key>
    20782     <column id="3351" parent="3264" name="discussion_id">
     20847    <column id="3358" parent="3265" name="discussion_id">
    2078320848      <DataType>integer|0s</DataType>
    2078420849      <NotNull>1</NotNull>
     
    2078720852      <TypeId>23</TypeId>
    2078820853    </column>
    20789     <column id="3352" parent="3264" name="reply_id">
     20854    <column id="3359" parent="3265" name="reply_id">
    2079020855      <DataType>integer|0s</DataType>
    2079120856      <DefaultExpression>nextval(&apos;project.replies_reply_id_seq&apos;::regclass)</DefaultExpression>
     
    2079520860      <TypeId>23</TypeId>
    2079620861    </column>
    20797     <column id="3353" parent="3264" name="text">
     20862    <column id="3360" parent="3265" name="text">
    2079820863      <DataType>varchar(1000)|0s</DataType>
    2079920864      <NotNull>1</NotNull>
     
    2080220867      <TypeId>1043</TypeId>
    2080320868    </column>
    20804     <column id="3354" parent="3264" name="date">
     20869    <column id="3361" parent="3265" name="date">
    2080520870      <DataType>date|0s</DataType>
    2080620871      <NotNull>1</NotNull>
     
    2080920874      <TypeId>1082</TypeId>
    2081020875    </column>
    20811     <column id="3355" parent="3264" name="user_id">
     20876    <column id="3362" parent="3265" name="user_id">
    2081220877      <DataType>integer|0s</DataType>
    2081320878      <NotNull>1</NotNull>
     
    2081620881      <TypeId>23</TypeId>
    2081720882    </column>
    20818     <foreign-key id="3356" parent="3264" name="fk_reply_discussion">
     20883    <foreign-key id="3363" parent="3265" name="fk_reply_discussion">
    2081920884      <ColNames>discussion_id</ColNames>
    2082020885      <ObjectId>157282</ObjectId>
     
    2082820893      <RefTableName>discussions</RefTableName>
    2082920894    </foreign-key>
    20830     <foreign-key id="3357" parent="3264" name="fk_user_create_reply">
     20895    <foreign-key id="3364" parent="3265" name="fk_user_create_reply">
    2083120896      <ColNames>user_id</ColNames>
    2083220897      <ObjectId>157277</ObjectId>
     
    2084020905      <RefTableName>users</RefTableName>
    2084120906    </foreign-key>
    20842     <index id="3358" parent="3264" name="pk_replies">
     20907    <index id="3365" parent="3265" name="pk_replies">
    2084320908      <ClassIds>1978,1978</ClassIds>
    2084420909      <ColNames>discussion_id
     
    2085120916      <AccessMethodId>403</AccessMethodId>
    2085220917    </index>
    20853     <key id="3359" parent="3264" name="pk_replies">
     20918    <key id="3366" parent="3265" name="pk_replies">
    2085420919      <ColNames>discussion_id
    2085520920reply_id</ColNames>
     
    2085920924      <UnderlyingIndexId>157275</UnderlyingIndexId>
    2086020925    </key>
    20861     <column id="3360" parent="3265" name="user_id">
     20926    <column id="3367" parent="3266" name="user_id">
    2086220927      <DataType>integer|0s</DataType>
    2086320928      <NotNull>1</NotNull>
     
    2086620931      <TypeId>23</TypeId>
    2086720932    </column>
    20868     <column id="3361" parent="3265" name="genre_id">
     20933    <column id="3368" parent="3266" name="genre_id">
    2086920934      <DataType>integer|0s</DataType>
    2087020935      <NotNull>1</NotNull>
     
    2087320938      <TypeId>23</TypeId>
    2087420939    </column>
    20875     <foreign-key id="3362" parent="3265" name="fk_user_genre">
     20940    <foreign-key id="3369" parent="3266" name="fk_user_genre">
    2087620941      <ColNames>user_id</ColNames>
    2087720942      <ObjectId>157201</ObjectId>
     
    2088520950      <RefTableName>users</RefTableName>
    2088620951    </foreign-key>
    20887     <foreign-key id="3363" parent="3265" name="fk_genre_like_user">
     20952    <foreign-key id="3370" parent="3266" name="fk_genre_like_user">
    2088820953      <ColNames>genre_id</ColNames>
    2088920954      <ObjectId>157206</ObjectId>
     
    2089720962      <RefTableName>genres</RefTableName>
    2089820963    </foreign-key>
    20899     <index id="3364" parent="3265" name="pk_user_genres">
     20964    <index id="3371" parent="3266" name="pk_user_genres">
    2090020965      <ClassIds>1978,1978</ClassIds>
    2090120966      <ColNames>user_id
     
    2090820973      <AccessMethodId>403</AccessMethodId>
    2090920974    </index>
    20910     <key id="3365" parent="3265" name="pk_user_genres">
     20975    <key id="3372" parent="3266" name="pk_user_genres">
    2091120976      <ColNames>user_id
    2091220977genre_id</ColNames>
     
    2091620981      <UnderlyingIndexId>157199</UnderlyingIndexId>
    2091720982    </key>
    20918     <check id="3366" parent="3266" name="ck_password">
     20983    <check id="3373" parent="3267" name="ck_password">
    2091920984      <ColNames>password</ColNames>
    2092020985      <ObjectId>191584</ObjectId>
     
    2092220987      <StateNumber>141874</StateNumber>
    2092320988    </check>
    20924     <column id="3367" parent="3266" name="user_id">
     20989    <column id="3374" parent="3267" name="user_id">
    2092520990      <DataType>integer|0s</DataType>
    2092620991      <DefaultExpression>nextval(&apos;project.users_user_id_seq&apos;::regclass)</DefaultExpression>
     
    2093020995      <TypeId>23</TypeId>
    2093120996    </column>
    20932     <column id="3368" parent="3266" name="username">
     20997    <column id="3375" parent="3267" name="username">
    2093320998      <DataType>varchar(50)|0s</DataType>
    2093420999      <NotNull>1</NotNull>
     
    2093721002      <TypeId>1043</TypeId>
    2093821003    </column>
    20939     <column id="3369" parent="3266" name="name">
     21004    <column id="3376" parent="3267" name="name">
    2094021005      <DataType>varchar(50)|0s</DataType>
    2094121006      <NotNull>1</NotNull>
     
    2094421009      <TypeId>1043</TypeId>
    2094521010    </column>
    20946     <column id="3370" parent="3266" name="surname">
     21011    <column id="3377" parent="3267" name="surname">
    2094721012      <DataType>varchar(50)|0s</DataType>
    2094821013      <NotNull>1</NotNull>
     
    2095121016      <TypeId>1043</TypeId>
    2095221017    </column>
    20953     <column id="3371" parent="3266" name="email">
     21018    <column id="3378" parent="3267" name="email">
    2095421019      <DataType>varchar(100)|0s</DataType>
    2095521020      <NotNull>1</NotNull>
     
    2095821023      <TypeId>1043</TypeId>
    2095921024    </column>
    20960     <column id="3372" parent="3266" name="password">
     21025    <column id="3379" parent="3267" name="password">
    2096121026      <DataType>varchar(128)|0s</DataType>
    2096221027      <NotNull>1</NotNull>
     
    2096521030      <TypeId>1043</TypeId>
    2096621031    </column>
    20967     <index id="3373" parent="3266" name="users_pkey">
     21032    <index id="3380" parent="3267" name="users_pkey">
    2096821033      <ClassIds>1978</ClassIds>
    2096921034      <ColNames>user_id</ColNames>
     
    2097621041      <AccessMethodId>403</AccessMethodId>
    2097721042    </index>
    20978     <index id="3374" parent="3266" name="users_username_key">
     21043    <index id="3381" parent="3267" name="users_username_key">
    2097921044      <ClassIds>3126</ClassIds>
    2098021045      <ColNames>username</ColNames>
     
    2098721052      <AccessMethodId>403</AccessMethodId>
    2098821053    </index>
    20989     <index id="3375" parent="3266" name="users_email_key">
     21054    <index id="3382" parent="3267" name="users_email_key">
    2099021055      <ClassIds>3126</ClassIds>
    2099121056      <ColNames>email</ColNames>
     
    2099821063      <AccessMethodId>403</AccessMethodId>
    2099921064    </index>
    21000     <key id="3376" parent="3266" name="users_pkey">
     21065    <key id="3383" parent="3267" name="users_pkey">
    2100121066      <ColNames>user_id</ColNames>
    2100221067      <NameSurrogate>1</NameSurrogate>
     
    2100621071      <UnderlyingIndexId>157108</UnderlyingIndexId>
    2100721072    </key>
    21008     <key id="3377" parent="3266" name="users_username_key">
     21073    <key id="3384" parent="3267" name="users_username_key">
    2100921074      <ColNames>username</ColNames>
    2101021075      <NameSurrogate>1</NameSurrogate>
     
    2101321078      <UnderlyingIndexId>157110</UnderlyingIndexId>
    2101421079    </key>
    21015     <key id="3378" parent="3266" name="users_email_key">
     21080    <key id="3385" parent="3267" name="users_email_key">
    2101621081      <ColNames>email</ColNames>
    2101721082      <NameSurrogate>1</NameSurrogate>
  • .idea/dataSources/14a5fbd7-f501-41df-a0af-e3b168b536f7/storage_v2/_src_/database/db_202122z_va_prj_wediscussmovies.LUavmg/schema/project.GUuQ7Q.meta

    r6f91f99 r8f1b7e9  
    11#n:project
    2 !<md> [147247, 0, null, null, -2147483648, -2147483648]
     2!<md> [148617, 0, null, null, -2147483648, -2147483648]
  • src/main/java/com/wediscussmovies/project/model/Discussion.java

    r6f91f99 r8f1b7e9  
    11package com.wediscussmovies.project.model;
    22
    3 import com.wediscussmovies.project.model.relation.DiscussionLikes;
     3import lombok.AllArgsConstructor;
    44import lombok.Data;
     5import org.springframework.beans.factory.annotation.Value;
    56
    67import javax.persistence.*;
    7 import java.sql.Date;
    8 import java.util.List;
     8import java.time.LocalDate;
    99import java.util.Objects;
    1010
     
    2828    @Basic
    2929    @Column(name = "date")
    30     private Date date;
     30    private LocalDate date;
    3131
    3232
     
    4747
    4848    @Transient
    49     private Long likes;
     49    private long likes;
    5050
    51     public Discussion(Character type, String text, String title, Date date, User user) {
     51    public Discussion(Character type, String text, String title, LocalDate date, User user) {
    5252        this.type = type;
    5353        this.text = text;
     
    5656        this.user = user;
    5757    }
     58
     59
    5860
    5961    public Discussion() {
  • src/main/java/com/wediscussmovies/project/model/Movie.java

    r6f91f99 r8f1b7e9  
    99
    1010import javax.persistence.*;
     11import java.io.Serializable;
    1112import java.sql.Date;
    1213import java.util.Collection;
  • src/main/java/com/wediscussmovies/project/model/Person.java

    r6f91f99 r8f1b7e9  
    77import javax.persistence.*;
    88import javax.swing.text.DateFormatter;
     9import java.io.Serializable;
    910import java.sql.Date;
    1011import java.time.LocalDate;
  • src/main/java/com/wediscussmovies/project/model/User.java

    r6f91f99 r8f1b7e9  
    1010
    1111import javax.persistence.*;
     12import java.io.Serializable;
    1213import java.util.ArrayList;
    1314import java.util.Collection;
  • src/main/java/com/wediscussmovies/project/querymodels/DiscussionLikesQM.java

    r6f91f99 r8f1b7e9  
    11package com.wediscussmovies.project.querymodels;
    22
     3import com.wediscussmovies.project.model.Movie;
     4import com.wediscussmovies.project.model.Person;
     5import com.wediscussmovies.project.model.User;
     6import lombok.AllArgsConstructor;
    37import lombok.Data;
     8import lombok.NoArgsConstructor;
    49
     10import java.time.LocalDate;
     11import java.util.Date;
    512import java.util.Objects;
    613
    714@Data
     15@AllArgsConstructor
     16@NoArgsConstructor
    817public class DiscussionLikesQM {
     18
    919    private Integer discussionId;
    1020    private Long likes;
    11 
    12     public DiscussionLikesQM(Integer discussionId, Long likes) {
    13         this.discussionId = discussionId;
    14         this.likes = likes;
    15     }
    16 
    17     public DiscussionLikesQM() {
    18     }
    1921
    2022    @Override
  • src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java

    r6f91f99 r8f1b7e9  
    1919     List<Discussion> findAllByPerson (Person person);
    2020
    21      @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM(d.discussionId, count(dl.id.userId)) from Discussion d" +
     21     @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM(d.discussionId, count (dl.user) ) from Discussion d" +
    2222             " left join DiscussionLikes dl on dl.id.discussionId = d.discussionId" +
    23              " where :discussionId = d.discussionId" +
    24              " group by d.discussionId"+
    25              " order by count(dl.id.userId) desc")
     23             " where :id = d.discussionId" +
     24             " group by d.discussionId")
    2625     @Transactional
    27      DiscussionLikesQM findDiscussionWithLikes(@Param("discussionId") Integer discussionId);
     26     DiscussionLikesQM findDiscussionWithLikes(@Param("id") Integer discussionId);
    2827
    29      @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM(d.discussionId, count(dl.id.userId)) from Discussion d" +
     28     @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM (d.discussionId, count(dl.user)) from Discussion d" +
    3029             " left join DiscussionLikes dl on dl.id.discussionId = d.discussionId" +
    3130             " group by d.discussionId"+
    32              " order by count(dl.id.userId) desc")
     31               " order by d.discussionId asc")
    3332     @Transactional
    34      List<DiscussionLikesQM> findAllDiscussionsWithLikes();
     33     List<DiscussionLikesQM
     34             > findAllDiscussionsWithLikes();
    3535}
  • src/main/java/com/wediscussmovies/project/service/DiscussionService.java

    r6f91f99 r8f1b7e9  
    2222    DiscussionLikesQM findLikesForDiscussionWithId(Integer discussionId);
    2323
    24     void findLikesForAllDiscussions(List<Discussion> discussions);
     24    List<DiscussionLikesQM> findLikesForAllDiscussions();
    2525
    2626}
  • src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java

    r6f91f99 r8f1b7e9  
    1616import org.springframework.stereotype.Service;
    1717
    18 import java.sql.Date;
    1918import java.time.LocalDate;
    2019import java.util.ArrayList;
    2120import java.util.List;
     21import java.util.concurrent.atomic.AtomicInteger;
    2222
    2323@Service
     
    4545    @Override
    4646    public List<Discussion> listAll() {
    47         return this.discussionRepository.findAll();
     47        List<Discussion> discussions = this.discussionRepository.findAll();
     48        List<DiscussionLikesQM> discussionLikes  = this.discussionRepository.findAllDiscussionsWithLikes();
     49        for (int i = 0; i < discussionLikes.size(); i++){
     50            discussions.get(i).setLikes(discussionLikes.get(i).getLikes());
     51        }
     52        return discussions;
    4853    }
    4954
    5055    @Override
    5156    public void save(Character type,Integer id,String title, String text,User user) {
    52         Date date = Date.valueOf(LocalDate.now());
     57        LocalDate date = LocalDate.now();
    5358        Discussion discussion;
    5459
     
    123128
    124129    @Override
    125     public void findLikesForAllDiscussions(List<Discussion> discussions) {
    126 //        this.discussionRepository.findAllDiscussionsWithLikes()
    127 //                .forEach(el ->{
    128 //                        if (discussions.)
    129 //                });
     130    public List<DiscussionLikesQM> findLikesForAllDiscussions() {
     131           // return this.discussionRepository.findAllDiscussionsWithLikes();
     132        return this.discussionRepository.findAllDiscussionsWithLikes();
    130133    }
    131134
     
    145148    @Override
    146149    public Discussion findById(Integer id) {
    147         return discussionRepository.findById(id).orElseThrow(() -> new DiscussionNotExistException(id));
     150        Discussion disc =  discussionRepository.findById(id).orElseThrow(() -> new DiscussionNotExistException(id));
     151        disc.setLikes(this.discussionRepository.findDiscussionWithLikes(id).getLikes());
     152        return disc;
    148153    }
    149154
  • src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java

    r6f91f99 r8f1b7e9  
    4545
    4646         */
    47         List<Discussion> discussions = discussionService.listAllByTitle(titleSearch);
     47        //List<Discussion> discussions = discussionService.listAllByTitle(titleSearch);
     48        List<Discussion> discussions = discussionService.listAll();
    4849        model.addAttribute("discussions", discussions);
    4950        model.addAttribute("contentTemplate", "discussionsList");
    5051        model.addAttribute("user",LoggedUser.getLoggedUser());
    5152        this.addModelPropertiesForUser(model);
    52         this.addModelPropertiesLikes(model,null, discussions);
     53       // this.addModelPropertiesLikes(model,null, discussions);
    5354        return "template";
    5455    }
     
    6364        try {
    6465            Discussion disc = discussionService.findById(id);
    65             disc.setLikes(discussionService.findLikesForDiscussionWithId(disc.getDiscussionId()).getLikes());
    6666            model.addAttribute("disc", disc);
    6767            model.addAttribute("contentTemplate", "discussion");
     
    185185        // ispagja kompliciran kod vaka, podobro da dodademe i svojstvo u diskusijata i koga ke se dodade lajk
    186186        // soodvetno da se zgoleme i obratno
    187         if(discussion==null){
    188             List<DiscussionLikesQM> discussionLikes = new ArrayList<>();
    189             for(Discussion d: discussions){
    190                 discussionLikes.add(discussionService.findLikesForDiscussionWithId(d.getDiscussionId()));
    191             }
    192             model.addAttribute("likes", discussionLikes);
    193         }
    194         else{
    195             model.addAttribute("likes",discussionService.findLikesForDiscussionWithId(discussion.getDiscussionId()).getLikes());
    196         }
     187//        if(discussion==null){
     188//            List<DiscussionLikesQM> discussionLikes = new ArrayList<>();
     189//            for(Discussion d: discussions){
     190//                discussionLikes.add(discussionService.findLikesForDiscussionWithId(d.getDiscussionId()));
     191//            }
     192//            model.addAttribute("likes", discussionLikes);
     193//        }
     194//        else{
     195//            model.addAttribute("likes",discussionService.findLikesForDiscussionWithId(discussion.getDiscussionId()).getLikes());
     196//        }
    197197    }
    198198
  • src/main/resources/templates/discussion.html

    r6f91f99 r8f1b7e9  
    1515            </span>
    1616            <span>Број на допаѓања:</span>
    17             <span th:text="${likes}" id="likes_count"></span>
     17            <span th:text="${disc.getLikes()}" id="likes_count"></span>
    1818        </h4>
    1919        <br>
  • src/main/resources/templates/discussionsList.html

    r6f91f99 r8f1b7e9  
    3131                                <a th:text="${disc.getTitle()}" th:href="@{'/discussions/{id}' (id=${disc.getDiscussionId()})}"></a>
    3232                            </td>
    33                             <td th:text="${disc.getLikes()}" class="likes_count">
     33                            <td th:text="${disc.getLikes() != null ? disc.getLikes() : 0}" class="likes_count">
    3434                            </td>
    3535                            <td th:text="${disc.getDate()}"></td>
  • target/classes/templates/discussion.html

    r6f91f99 r8f1b7e9  
    1515            </span>
    1616            <span>Број на допаѓања:</span>
    17             <span th:text="${likes}" id="likes_count"></span>
     17            <span th:text="${disc.getLikes()}" id="likes_count"></span>
    1818        </h4>
    1919        <br>
  • target/classes/templates/discussionsList.html

    r6f91f99 r8f1b7e9  
    3131                                <a th:text="${disc.getTitle()}" th:href="@{'/discussions/{id}' (id=${disc.getDiscussionId()})}"></a>
    3232                            </td>
    33                             <td th:each="like : ${likes}" th:if="${like.getDiscussionId().equals(disc.getDiscussionId())}" th:text="${like.getLikes()}" class="likes_count">
     33                            <td th:text="${disc.getLikes() != null ? disc.getLikes() : 0}" class="likes_count">
    3434                            </td>
    3535                            <td th:text="${disc.getDate()}"></td>
     
    4141                            <td th:if="${!disc.getUser().equals(user)}"><a class="btn btn-success" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
    4242                            <td th:if="${!disc.getUser().equals(user)}">
    43                                 <a class='btn btn-success button-like-discussion-alt' th:if="${!likedDiscussions.contains(disc)}" th:discussion-id="${disc.getDiscussionId()}" th:user-id="${user.getUserId()}" >❤</a>
    44                                 <a class='btn btn-danger button-unlike-discussion-alt' th:if="${likedDiscussions.contains(disc)}" th:discussion-id="${disc.getDiscussionId()}" th:user-id="${user.getUserId()}" >💔</a>
     43                                <a class='btn btn-success button-like-discussion-alt' th:if="${!likedDiscussions.contains(disc)}" th:discussion-id="${disc?.getDiscussionId()}" th:user-id="${user.getUserId()}" >❤</a>
     44                                <a class='btn btn-danger button-unlike-discussion-alt' th:if="${likedDiscussions.contains(disc)}" th:discussion-id="${disc?.getDiscussionId()}" th:user-id="${user.getUserId()}" >💔</a>
    4545                            </td>
    4646                            </th:block>
Note: See TracChangeset for help on using the changeset viewer.