NameL3ss

grupos padre/hijo archivos

Jun 7th, 2025 (edited)
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. contenedores_archivos = DocumentAttribute.find_by_name("contenedores archivos")
  2.  
  3. #<DocumentAttribute:0x00000001144f7080
  4. id: 145,
  5. name: "contenedores archivos",
  6. type_cd: 3,
  7. active: nil,
  8. created_at: Sat, 08 Jun 2024 00:14:21 -04 -04:00,
  9. updated_at: Thu, 15 May 2025 22:13:20 -04 -04:00,
  10. deleted_at: nil,
  11. document_attribute_id: nil,
  12. description: nil,
  13. ner_type: nil,
  14. local_id: "42e4ee2f-b809-4ffe-b7e0-7ad72124529c",
  15. allows_create_options_on_classification: false,
  16.  
  17.  
  18. luego tiene N grupos
  19.  
  20. {
  21. id: 1,
  22. attribute_parent_id: "115", -> padre -> el que debo seleccionar "tipos de docu"
  23. attribute_child_id: "145", -> atributo principal "contenedores archivos"
  24. customer_id: 1
  25. value: "pdf", hijo -> la opcion del padre que debo seleccionar "pdf"
  26. }
  27.  
  28. tipos_docu = DocumentAttribute.find_by_name("tipos de docu")
  29. => #<DocumentAttribute:0x000000011224ad20
  30. id: 115,
  31. name: "tipos de docu",
  32. type_cd: 3,
  33. active: nil,
  34. created_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  35. updated_at: Wed, 16 Apr 2025 13:02:48 -04 -04:00,
  36. deleted_at: nil,
  37. document_attribute_id: nil,
  38. description: nil,
  39. ner_type: nil,
  40. local_id: "67e41877-a2db-4ca9-adce-97319f5c3b3d",
  41. allows_create_options_on_classification: true,
  42. position: 3,
  43. autofill: false>
  44.  
  45. tipos_docu.options
  46. => [#<DocumentAttributeOption:0x00000001064a2f70
  47. id: 433,
  48. document_attribute_id: 115,
  49. value: "word",
  50. active: nil,
  51. created_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  52. updated_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  53. customer_id: 1,
  54. tag: nil,
  55. struct_attributes: nil,
  56. deleted_at: nil,
  57. local_id: "72c38270-3c4c-4208-80cb-47cc5b166b77">,
  58. #<DocumentAttributeOption:0x00000001064a2a20
  59. id: 434,
  60. document_attribute_id: 115,
  61. value: "pdf",
  62. active: nil,
  63. created_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  64. updated_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  65. customer_id: 1,
  66. tag: nil,
  67. struct_attributes: nil,
  68. deleted_at: nil,
  69. local_id: "be16b1f2-a530-4908-a1c5-5c593b7dfdf1">]
  70.  
  71. si selecciono "tipos de docu" y luego la opcion pdf aparece contenedores de archivos
  72.  
  73. {
  74. id: 3,
  75. attribute_parent_id: "topic",
  76. attribute_child_id: "145",
  77. customer_id: 1,
  78. value: "empty"
  79. }
  80.  
  81. Otro caso si selecciono "Asunto" que es topic y si selecciono la opcion "empty" aparece contenedores de archivos
  82.  
  83.  
  84.  
  85.  
  86. parent_1 = DocumentAttribute.find_by_name("tipos de docu")
  87.  
  88. #<DocumentAttribute:0x0000000105dcfdb0
  89. id: 115,
  90. name: "tipos de docu",
  91. type_cd: 3,
  92. active: nil,
  93. created_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  94. updated_at: Wed, 16 Apr 2025 13:02:48 -04 -04:00,
  95. deleted_at: nil,
  96. document_attribute_id: nil,
  97. description: nil,
  98. ner_type: nil,
  99. local_id: "67e41877-a2db-4ca9-adce-97319f5c3b3d",
  100. allows_create_options_on_classification: true,
  101.  
  102. child_1 = parent_1.document_attribute_options.find_by_value("pdf")
  103. #<DocumentAttributeOption:0x0000000117072ca0
  104. id: 434,
  105. document_attribute_id: 115,
  106. value: "pdf",
  107. active: nil,
  108. created_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  109. updated_at: Tue, 10 Oct 2023 16:19:53 -03 -03:00,
  110. customer_id: 1,
  111. tag: nil,
  112. struct_attributes: nil,
  113. deleted_at: nil,
  114. local_id: "be16b1f2-a530-4908-a1c5-5c593b7dfdf1">
  115.  
  116.  
  117. caso de estaticos
  118. {
  119. id: 3,
  120. attribute_parent_id: "topic",
  121. attribute_child_id: "145",
  122. customer_id: 1,
  123. value: "empty"
  124. },
  125.  
  126. buscar topic -> o equivalente "Asunto" => padre
  127. buscar topic con value "empty" => hijo child Topic.find_by_name("empty")
  128.  
  129. endpoint trae todos los atributos de tipo lista CON opciones y que no sean de tipo topic/subject/etc
  130. servicio de creacion de nesteed attributes para grupos/padres/hijos
  131. agregar a actuales atributos los childs atributes
  132. agregar atributo boolean a las colecciones para saber si requieren atencion
  133.  
  134.  
  135.  
  136. que sucede con la migracion de atributos actuales, con respecto a los que usan topic/subject/etc? no se migraran?
  137.  
  138. atributo -> dependencia1/dependencia2
  139. se elimina la dependencia2
  140. la coleccion tiene la dependencia1, es necesario avisar que se elimino la dependencia2? o que cambie algo en esa coleccion en especifico?
  141. lo mismo al editar... ???
  142.  
  143. si un atributo tiene 2 dependencias y se elimina una dependencia pero la coleccion ya tiene la otra
  144.  
  145.  
  146.  
  147.  
  148.  
  149. endpoint para devolver atributos de tipo lista siempre y cuando tengan opciones
  150.  
  151. criterios
  152. un atributo no se puede mostrar a si mismo
  153.  
Advertisement
Add Comment
Please, Sign In to add comment