From 0d0860dc90b8eb5d31205be74f120b591ad86369 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 24 Oct 2025 11:05:01 +0700 Subject: [PATCH 1/9] migration from server --- cmd/main-migration/migrations/atlas.sum | 118 ++++++++++++------------ 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index f65af68d..4a370f6a 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,59 +1,59 @@ -h1:iDCRTkq1AjDg/YtmmPXwu6TAXJeoXQuXfDZG99Pi6cY= -20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= -20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= -20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= -20250908062323.sql h1:oXl6Z143tOpIl4EfP4B8JNU8LrMvVmHEtCgAfiB4gs8= -20250908073811.sql h1:m2aNXfnGxnLq1+rVWrh4f60q7fhyhV3gEwNu/OIqQlE= -20250908073839.sql h1:cPk54xjLdMs26uY8ZHjNWLuyfAMzV7Zb0/9oJQrsw04= -20250910055902.sql h1:5xwjAV6QbtZT9empTJKfhyAjdknbHzb15B0Ku5dzqtQ= -20250915123412.sql h1:D83xaU2YlDEd21HLup/YQpQ2easMToYCyy/oK6AFgQs= -20250916043819.sql h1:ekoTJsBqQZ8G8n0qJ03d13+eoNoc7sAUEQGA5D/CCxk= -20250917040616.sql h1:zoCnmcXuM7AVv85SmN7RmFglCgJnoDmpRWExH0LAc9Q= -20250917040751.sql h1:J1xyRrh32y1+lezwAyNwPcUQ6ABBSgbvzNLva4SVdQU= -20250917045138.sql h1:jKe1Z0uOLG4SGBYM+S/3P+/zMPztmgoderD5swnMuCg= -20250917093645.sql h1:cNI3Pbz1R3LxvIXLuexafJFCXUXrmuFCgXXJ2sG+FW0= -20250918073552.sql h1:RJ1SvMzP6aeWnoPVD3eVAmIQOkcp6Php8z3QRri6v4g= -20250918073742.sql h1:+cEsnJTJFybe2fR69ZoOiX2R6c6iITl4m6WTZ1hjyzY= -20250918074745.sql h1:2hNVQCXF/dVYXAh+T/7oBFgERGWxzVb2FXJjwkFWGCI= -20250923025134.sql h1:Ykz/qpHiGDXPsCsWTjydQFVSibZP2D+h2fIeb2h2JGA= -20250924051317.sql h1:yQuW6SwJxIOM5fcxeAaie5lSm1oLysU/C2hH2xNCVoQ= -20250929034321.sql h1:101FJ8VH12mrZWlt/X1gvKUGOhoiF8tFbjiapAjnHzg= -20250929034428.sql h1:i+pROD9p+g5dOmmZma6WF/0Hw5g3Ha28NN85iTo1K34= -20250930025550.sql h1:+F+CsCUXD/ql0tHGEow70GhPBX1ZybVn+bh/T4YMh7Y= -20250930140351.sql h1:9AAEG1AnOAH+o0+oHL5G7I8vqlWOhwRlCGyyCpT/y1Q= -20251002085604.sql h1:3xZ68eYp4urXRnvotNH1XvG2mYOSDV/j3zHEZ/txg5E= -20251003032030.sql h1:HB+mQ2lXMNomHDpaRhB/9IwYI9/YiDO5eOJ+nAQH/jw= -20251005060450.sql h1:LbtCE2b+8osM3CvnmQJH1uCPtn+d7WchsslBOz8bL3Q= -20251006041122.sql h1:MlS7f21z06sutnf9dIekt5fuHJr4lgcQ4uCuCXAGsfc= -20251006045658.sql h1:3FmGCPCzjgMPdWDRodZTsx3KVaodd9zB9ilib69aewk= -20251006045928.sql h1:Z5g31PmnzNwk/OKdODcxZGm8fjJQdMFK32Xfnt3bRHg= -20251007022859.sql h1:FO03zEfaNEk/aXwY81d5Lp3MoBB9kPQuXlXJ4BPiSR8= -20251008031337.sql h1:l+sxUAGvcTfj3I6kAFHo+T6AYodC9k9GkR+jaKO2xXc= -20251008031554.sql h1:AqrVfIhSzY3PCy8ZlP5W91wn2iznfIuj5qQfubp6/94= -20251008052346.sql h1:nxnXmooIJ6r1mmzwnw+6efxLfc/k9h2aE6RMptPRons= -20251008073620.sql h1:6YsJp1W4SmQJ1lxpqF27BBlDC1zqhw7Yhc7pLzQTY6M= -20251009042854.sql h1:nkBV+R6j0fg7/JY6wH3eb5Vv0asJLnXmb6lINfT/GLQ= -20251009052657.sql h1:EPvdsib5rzCGPryd10HShGKvFPwM/R5S2lIVwtYxpms= -20251010031743.sql h1:T8IZmx8/btRFKLzTe78MzcBsPJNodnLvB0tby9QkirQ= -20251010070721.sql h1:5NQUk/yOV6sABLCB7swx++YIOyJe6MnU+yt1nRzde5w= -20251010072711.sql h1:ZJNqR2piyu8xJhBvVABSlnGEoKSKae3wuEs+wshPe4k= -20251013044536.sql h1:0Xjw8fNILiT8nnfrJDZgQnPf3dntmIoilbapnih8AE4= -20251013051438.sql h1:lfSuw5mgJnePBJamvhZ81osFIouXeiIEiSZ/evdwo48= -20251013081808.sql h1:ijgjNX08G6GBjA/ks8EKtb7P7Y7Cg7zbhqEOruGnv6M= -20251014060047.sql h1:0jqj49WTtneEIMQDBoo4c095ZGi8sCrA8NnHBrPU6D8= -20251014063537.sql h1:VZLXol0PTsTW21Epg6vBPsztWkDtcxup9F/z88EGgIg= -20251014063720.sql h1:2HVUyCV0ud3BJJDH2GEKZN/+IWLFPCsN1KqhP6csO14= -20251015045455.sql h1:MeLWmMhAOAz8b15Dd7IAQnt6JxjSml02XCXK22C0Lpg= -20251016010845.sql h1:4BncQdDOasRZJkzVJrSJJA7091A9VPNVx/faUCUPhBM= -20251016011023.sql h1:9JB9eFZKURK5RoCVDKR6glSvdJ8NTXrN7K/4q51zkz4= -20251016062912.sql h1:ACNn0fe+EMqUt3hoY+Dr3uqAV/QICBa1+mIW7fUc9Fk= -20251017060617.sql h1:4T3t9ifWrEQTPMSM0XJ98pF7Qdt+UfgtMui17bhrnWI= -20251017082207.sql h1:8vLG1l/saRRMHXkyA4nelJyjaSddhZd6r7R+Uo4JS/c= -20251018032635.sql h1:2xey5gnO3y2XSOrU8MLlIfoylPKbRGDRtHDD07B3MbQ= -20251018040322.sql h1:k/pdNiSoT8zFPqNQ/avOD0vYkNh3BTD64IlHrfVXr7I= -20251019093915.sql h1:hFcQE0y+p5dZiVwePGsRGto9m/q6kJNiUZbVDd5Rnjk= -20251020062553.sql h1:Iw7hulcm5iRQlfW+ygA4iTPxLqkxx6h9vXMXEwUAHKs= -20251021041042.sql h1:wMgSivBV2A0NDcsLmKGIp0kMcVh2IODSG9b4dgzCaOM= -20251021075552.sql h1:8gfSMAglflNO6L0sSzxFNEubYN8/O4thT7OQT+WH+3M= -20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA= -20251024034832.sql h1:SoqYFfkaTTiY18PWY+l8+dqUlZtCUjSsbC0L1swsD3s= +h1:HozaE+KMdV5bp0Z1QR6FiU5dW3npmFwbvxo+noqNuRQ= +20250904105930.sql h1:Vv4vCurl7m7/ZB6TjRpkubHpQ4RYwSUn0QHdzfoGpzY= +20250904141448.sql h1:FYCHH9Os4KkrZMDu/jR8FMP+wLMRW+Mb0PkLU/9BRDg= +20250908062237.sql h1:oanBpKZd+akPu2I/xYhUSbd0G5tAFbXzKLER/Zs8ENI= +20250908062323.sql h1:miNG9COddXkD1jGTgaROMAZ618eT6oiLGiJhXWnQwhE= +20250908073811.sql h1:gOi5cnGG1htlpfizybYmUIT0vYjZTBfXiI0nPSYK2u8= +20250908073839.sql h1:cWNDA4YikjoOteAJuNLFILjQUJPFB6o8Wxreiek4QyI= +20250910055902.sql h1:nxxOGnU0BbH/v3IPgeIOXOwH8d3tKomw7h6FTeMnnBs= +20250915123412.sql h1:mz7SiWfrdf0qE1VTSAAnA/147d6gyp6ry5vZ2bR9SH0= +20250916043819.sql h1:RHXVtmMkB6wfv06HfPyHMBmUfIpFt1xveafNz0kwKnE= +20250917040616.sql h1:MYVDht+akBlzQGKNu2hTTTLPEcH1bxT/Q8MK6WEtuhs= +20250917040751.sql h1:J79YyS2JzWgh5oKXMTgh67uo3gLxKaAsxRiZmSIfjBs= +20250917045138.sql h1:/SM1N4O8X3yxpoJgMEARmS1uOkuLKsTOy4PLsRCOKaQ= +20250917093645.sql h1:PNBTGZ7s10e5b5+Tie8YfVQBN0zKtJ5T34oK1iOUEb4= +20250918073552.sql h1:jG7+g3i8ODYaJdcdZz12v3nbsZ5mB9wG6kWnGyTQIRI= +20250918073742.sql h1:j+rgw7puxE7s+phqPVZHmPk0af3rcaA56Itp86y1suY= +20250918074745.sql h1:rPmP4DXs6OnY4Vp+xO/z9jFpJt/RrJ52SJJjIIxeDvc= +20250923025134.sql h1:2r6pcwnBSU5Y9Czk1OHBoh4yZXiMtEca9X8843fTEX0= +20250924051317.sql h1:iUAk2gsGoEGIPQ0lEEUp8maMSId8emNbP+kP712ABIA= +20250929034321.sql h1:UlpALNVmdi95zOIT0yc6ZyTj9bBjQEIpZhvgrc52M+k= +20250929034428.sql h1:feF+H4nDyHh5bdx48Oiz0A1qecZfi6v3qTTdjzJ45Dg= +20250930025550.sql h1:6XT1kXI3Z3ZIxxmvT7poufZWWCW0QiejZPaFV5wBnjI= +20250930140351.sql h1:HxnmAbh9gCy8jwl/9ycGktiByaUripsjFFvohofY2CY= +20251002085604.sql h1:SjLPi+ZN6qDccK3DaEQCgNsZpPwr5kynWXwbwEsziCI= +20251003032030.sql h1:oHfxNSuqTxU8Zaf9H+h8TuUb1Da03wcyc6hZjDrUQ2s= +20251005060450.sql h1:GIuCcrd4MwjmXpvbzDzPYL18BV3QaZZ+Y2FmEzjvi0E= +20251006041122.sql h1:uNDQbSw0M08lYoMvUNlQtS3iDzpPM1ixT13ugSAoWjE= +20251006045658.sql h1:z+t7yCK54Q4SSiF9kUyUhkYB2F+kzSW9TB7ogxd9wzw= +20251006045928.sql h1:1lATLFLp4BWwGZqAjZdP0Dc6ypNXiYcwjoNkqGa8NFE= +20251007022859.sql h1:HXXwWrkyvzJzJGAt9mGskCRBBV/c1JfPmfjDocmJhQ4= +20251008031337.sql h1:Ln5pCF3Hxa5foHZLcds+z/us2eH6VAhhEj3w0TAGlVs= +20251008031554.sql h1:aB4MUS2lmqG0//4HKUWorcPSpWya0VC4QItvGyskEVI= +20251008052346.sql h1:MI3AZgU5XcwZT2OvvlWAxdRtL0eJ3jjRwt56IY1+pRU= +20251008073620.sql h1:sztWXuSNYwpEraaSapSsYwno75LO5H/N7ob7OJQ8X/A= +20251009042854.sql h1:TnPXj+dCJls3IU//cuqJZymyBzZMKs7ayazfgtAFRxM= +20251009052657.sql h1:leXbs0CP8r5dRilmYyLRk1MICqak3ea1/LWMtFrijqQ= +20251010031743.sql h1:SgHNY/lQ88G2F4nZyMfiOkDntb+gtOR+nEQLqXBTwv4= +20251010070721.sql h1:AnJnhXsMzDvK4AFgYw6B16Kpo/hljrZtcpc9m2VOSHQ= +20251010072711.sql h1:aXPTtNwLcTuw8C/yAxwxvqs0ayEjNzI1uuE0vE3ERa8= +20251013044536.sql h1:7Pq6JcvTpPBYDCW2dz3HdgUwY65HlhEVWy9TiG8iONE= +20251013051438.sql h1:X6t8bkqpUYYokBunSufMQUe5vCg0VyO6dxbm7ngosUc= +20251013081808.sql h1:495pLguXL2Ozh+ycn4UYZgZbn6WbjXNbyZUc3JU8qhI= +20251014060047.sql h1:nCgImMRGHhziiW57O1ofWaXCAPGaCOHN7PldQ3OSmM4= +20251014063537.sql h1:2cLmID79jP6cuQ1YJaWTtghFiM1GtHMC0ZQl30Hpy1M= +20251014063720.sql h1:bzLKKVAjSHgDFoiI/glj7t1ETlSAKx+AlsIAaP0ru2g= +20251015045455.sql h1:S547+UugQhlTRcn1Lm1IfqT5RNPttIWIiD+RTx69YaE= +20251016010845.sql h1:c9DUvxl17pUkf0azdYGM/YDzYxIJkLcfZOcMI4rL+R0= +20251016011023.sql h1:u3ivg83bXgYHBbojbWpemLxPE9Dmmj53B6LXo664jxw= +20251016062912.sql h1:W9n1hWchfYkqNX9LO9uxFxEXAb/iY+Pexjnhmp6PbgI= +20251017060617.sql h1:VU6yZ2+LfHpDZ3+TIH40t3F5YXPCpTppuF9+uSqa4b8= +20251017082207.sql h1:QshZslfedckz7iDpSGmPyY9sP6dy6ckHbs8L1TuXIA4= +20251018032635.sql h1:M1U/9W/F9wlW5YDmVAmHFfUJU7FWFaX0DblpfZcYWrE= +20251018040322.sql h1:Zk/vw0e6AzWFO2ElLOzB+OrSz6k+h1Ynxp0TImAzxwY= +20251019093915.sql h1:3Q0kPiZwJnHn5rAvdh0w1LBdiA7W2xBmZWncoPXb044= +20251020062553.sql h1:mJwC/J8GzPAIXckNMvy1f/Nguk2VVf8roD/Raclhbao= +20251021041042.sql h1:d1BAOGAQhqr+oOwcpAVozUsTh457VSDEk2qQFavGG58= +20251021075552.sql h1:TNChGQ1Zlr/1iQ6qvK4iDTAJpe6L/z/M6e/O0SkQVaM= +20251023044432.sql h1:GA2AdJk2ULyjr6igtu9C/CEi4YUIks8r9jXGGaCvPsk= +20251024034832.sql h1:RXmbEhMkOLK5g1QL6up8iRPcwYfo89oLP26ZHvrUK9o= From 066574e0fea6e22c1a55b59805ea0565d35ac8f1 Mon Sep 17 00:00:00 2001 From: vanilia Date: Fri, 24 Oct 2025 12:16:36 +0700 Subject: [PATCH 2/9] adjustment positions --- cmd/main-migration/migrations/atlas.sum | 118 +++++++++--------- .../division-position/base/entity.go | 18 +++ .../main-entities/division-position/entity.go | 13 +- .../domain/main-entities/division/entity.go | 14 ++- .../installation-position/base/entity.go | 20 +++ .../installation-position/entity.go | 13 +- .../main-entities/installation/entity.go | 10 +- .../specialist-position/base/entity.go | 20 +++ .../specialist-position/entity.go | 13 +- .../domain/main-entities/specialist/entity.go | 12 +- .../subspecialist-position/base/entity.go | 20 +++ .../subspecialist-position/entity.go | 13 +- .../main-entities/subspecialist/entity.go | 12 +- .../unit-position/base/entity.go | 18 +++ .../main-entities/unit-position/entity.go | 13 +- internal/domain/main-entities/unit/entity.go | 2 + 16 files changed, 202 insertions(+), 127 deletions(-) create mode 100644 internal/domain/main-entities/division-position/base/entity.go create mode 100644 internal/domain/main-entities/installation-position/base/entity.go create mode 100644 internal/domain/main-entities/specialist-position/base/entity.go create mode 100644 internal/domain/main-entities/subspecialist-position/base/entity.go create mode 100644 internal/domain/main-entities/unit-position/base/entity.go diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 4a370f6a..a52827a6 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,59 +1,59 @@ -h1:HozaE+KMdV5bp0Z1QR6FiU5dW3npmFwbvxo+noqNuRQ= -20250904105930.sql h1:Vv4vCurl7m7/ZB6TjRpkubHpQ4RYwSUn0QHdzfoGpzY= -20250904141448.sql h1:FYCHH9Os4KkrZMDu/jR8FMP+wLMRW+Mb0PkLU/9BRDg= -20250908062237.sql h1:oanBpKZd+akPu2I/xYhUSbd0G5tAFbXzKLER/Zs8ENI= -20250908062323.sql h1:miNG9COddXkD1jGTgaROMAZ618eT6oiLGiJhXWnQwhE= -20250908073811.sql h1:gOi5cnGG1htlpfizybYmUIT0vYjZTBfXiI0nPSYK2u8= -20250908073839.sql h1:cWNDA4YikjoOteAJuNLFILjQUJPFB6o8Wxreiek4QyI= -20250910055902.sql h1:nxxOGnU0BbH/v3IPgeIOXOwH8d3tKomw7h6FTeMnnBs= -20250915123412.sql h1:mz7SiWfrdf0qE1VTSAAnA/147d6gyp6ry5vZ2bR9SH0= -20250916043819.sql h1:RHXVtmMkB6wfv06HfPyHMBmUfIpFt1xveafNz0kwKnE= -20250917040616.sql h1:MYVDht+akBlzQGKNu2hTTTLPEcH1bxT/Q8MK6WEtuhs= -20250917040751.sql h1:J79YyS2JzWgh5oKXMTgh67uo3gLxKaAsxRiZmSIfjBs= -20250917045138.sql h1:/SM1N4O8X3yxpoJgMEARmS1uOkuLKsTOy4PLsRCOKaQ= -20250917093645.sql h1:PNBTGZ7s10e5b5+Tie8YfVQBN0zKtJ5T34oK1iOUEb4= -20250918073552.sql h1:jG7+g3i8ODYaJdcdZz12v3nbsZ5mB9wG6kWnGyTQIRI= -20250918073742.sql h1:j+rgw7puxE7s+phqPVZHmPk0af3rcaA56Itp86y1suY= -20250918074745.sql h1:rPmP4DXs6OnY4Vp+xO/z9jFpJt/RrJ52SJJjIIxeDvc= -20250923025134.sql h1:2r6pcwnBSU5Y9Czk1OHBoh4yZXiMtEca9X8843fTEX0= -20250924051317.sql h1:iUAk2gsGoEGIPQ0lEEUp8maMSId8emNbP+kP712ABIA= -20250929034321.sql h1:UlpALNVmdi95zOIT0yc6ZyTj9bBjQEIpZhvgrc52M+k= -20250929034428.sql h1:feF+H4nDyHh5bdx48Oiz0A1qecZfi6v3qTTdjzJ45Dg= -20250930025550.sql h1:6XT1kXI3Z3ZIxxmvT7poufZWWCW0QiejZPaFV5wBnjI= -20250930140351.sql h1:HxnmAbh9gCy8jwl/9ycGktiByaUripsjFFvohofY2CY= -20251002085604.sql h1:SjLPi+ZN6qDccK3DaEQCgNsZpPwr5kynWXwbwEsziCI= -20251003032030.sql h1:oHfxNSuqTxU8Zaf9H+h8TuUb1Da03wcyc6hZjDrUQ2s= -20251005060450.sql h1:GIuCcrd4MwjmXpvbzDzPYL18BV3QaZZ+Y2FmEzjvi0E= -20251006041122.sql h1:uNDQbSw0M08lYoMvUNlQtS3iDzpPM1ixT13ugSAoWjE= -20251006045658.sql h1:z+t7yCK54Q4SSiF9kUyUhkYB2F+kzSW9TB7ogxd9wzw= -20251006045928.sql h1:1lATLFLp4BWwGZqAjZdP0Dc6ypNXiYcwjoNkqGa8NFE= -20251007022859.sql h1:HXXwWrkyvzJzJGAt9mGskCRBBV/c1JfPmfjDocmJhQ4= -20251008031337.sql h1:Ln5pCF3Hxa5foHZLcds+z/us2eH6VAhhEj3w0TAGlVs= -20251008031554.sql h1:aB4MUS2lmqG0//4HKUWorcPSpWya0VC4QItvGyskEVI= -20251008052346.sql h1:MI3AZgU5XcwZT2OvvlWAxdRtL0eJ3jjRwt56IY1+pRU= -20251008073620.sql h1:sztWXuSNYwpEraaSapSsYwno75LO5H/N7ob7OJQ8X/A= -20251009042854.sql h1:TnPXj+dCJls3IU//cuqJZymyBzZMKs7ayazfgtAFRxM= -20251009052657.sql h1:leXbs0CP8r5dRilmYyLRk1MICqak3ea1/LWMtFrijqQ= -20251010031743.sql h1:SgHNY/lQ88G2F4nZyMfiOkDntb+gtOR+nEQLqXBTwv4= -20251010070721.sql h1:AnJnhXsMzDvK4AFgYw6B16Kpo/hljrZtcpc9m2VOSHQ= -20251010072711.sql h1:aXPTtNwLcTuw8C/yAxwxvqs0ayEjNzI1uuE0vE3ERa8= -20251013044536.sql h1:7Pq6JcvTpPBYDCW2dz3HdgUwY65HlhEVWy9TiG8iONE= -20251013051438.sql h1:X6t8bkqpUYYokBunSufMQUe5vCg0VyO6dxbm7ngosUc= -20251013081808.sql h1:495pLguXL2Ozh+ycn4UYZgZbn6WbjXNbyZUc3JU8qhI= -20251014060047.sql h1:nCgImMRGHhziiW57O1ofWaXCAPGaCOHN7PldQ3OSmM4= -20251014063537.sql h1:2cLmID79jP6cuQ1YJaWTtghFiM1GtHMC0ZQl30Hpy1M= -20251014063720.sql h1:bzLKKVAjSHgDFoiI/glj7t1ETlSAKx+AlsIAaP0ru2g= -20251015045455.sql h1:S547+UugQhlTRcn1Lm1IfqT5RNPttIWIiD+RTx69YaE= -20251016010845.sql h1:c9DUvxl17pUkf0azdYGM/YDzYxIJkLcfZOcMI4rL+R0= -20251016011023.sql h1:u3ivg83bXgYHBbojbWpemLxPE9Dmmj53B6LXo664jxw= -20251016062912.sql h1:W9n1hWchfYkqNX9LO9uxFxEXAb/iY+Pexjnhmp6PbgI= -20251017060617.sql h1:VU6yZ2+LfHpDZ3+TIH40t3F5YXPCpTppuF9+uSqa4b8= -20251017082207.sql h1:QshZslfedckz7iDpSGmPyY9sP6dy6ckHbs8L1TuXIA4= -20251018032635.sql h1:M1U/9W/F9wlW5YDmVAmHFfUJU7FWFaX0DblpfZcYWrE= -20251018040322.sql h1:Zk/vw0e6AzWFO2ElLOzB+OrSz6k+h1Ynxp0TImAzxwY= -20251019093915.sql h1:3Q0kPiZwJnHn5rAvdh0w1LBdiA7W2xBmZWncoPXb044= -20251020062553.sql h1:mJwC/J8GzPAIXckNMvy1f/Nguk2VVf8roD/Raclhbao= -20251021041042.sql h1:d1BAOGAQhqr+oOwcpAVozUsTh457VSDEk2qQFavGG58= -20251021075552.sql h1:TNChGQ1Zlr/1iQ6qvK4iDTAJpe6L/z/M6e/O0SkQVaM= -20251023044432.sql h1:GA2AdJk2ULyjr6igtu9C/CEi4YUIks8r9jXGGaCvPsk= -20251024034832.sql h1:RXmbEhMkOLK5g1QL6up8iRPcwYfo89oLP26ZHvrUK9o= +h1:fAJxBGCfoMXYDjYBlq6RITZ/dXbqiYtQWwupcBMLHV0= +20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= +20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= +20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= +20250908062323.sql h1:oXl6Z143tOpIl4EfP4B8JNU8LrMvVmHEtCgAfiB4gs8= +20250908073811.sql h1:m2aNXfnGxnLq1+rVWrh4f60q7fhyhV3gEwNu/OIqQlE= +20250908073839.sql h1:cPk54xjLdMs26uY8ZHjNWLuyfAMzV7Zb0/9oJQrsw04= +20250910055902.sql h1:5xwjAV6QbtZT9empTJKfhyAjdknbHzb15B0Ku5dzqtQ= +20250915123412.sql h1:D83xaU2YlDEd21HLup/YQpQ2easMToYCyy/oK6AFgQs= +20250916043819.sql h1:ekoTJsBqQZ8G8n0qJ03d13+eoNoc7sAUEQGA5D/CCxk= +20250917040616.sql h1:zoCnmcXuM7AVv85SmN7RmFglCgJnoDmpRWExH0LAc9Q= +20250917040751.sql h1:J1xyRrh32y1+lezwAyNwPcUQ6ABBSgbvzNLva4SVdQU= +20250917045138.sql h1:jKe1Z0uOLG4SGBYM+S/3P+/zMPztmgoderD5swnMuCg= +20250917093645.sql h1:cNI3Pbz1R3LxvIXLuexafJFCXUXrmuFCgXXJ2sG+FW0= +20250918073552.sql h1:RJ1SvMzP6aeWnoPVD3eVAmIQOkcp6Php8z3QRri6v4g= +20250918073742.sql h1:+cEsnJTJFybe2fR69ZoOiX2R6c6iITl4m6WTZ1hjyzY= +20250918074745.sql h1:2hNVQCXF/dVYXAh+T/7oBFgERGWxzVb2FXJjwkFWGCI= +20250923025134.sql h1:Ykz/qpHiGDXPsCsWTjydQFVSibZP2D+h2fIeb2h2JGA= +20250924051317.sql h1:yQuW6SwJxIOM5fcxeAaie5lSm1oLysU/C2hH2xNCVoQ= +20250929034321.sql h1:101FJ8VH12mrZWlt/X1gvKUGOhoiF8tFbjiapAjnHzg= +20250929034428.sql h1:i+pROD9p+g5dOmmZma6WF/0Hw5g3Ha28NN85iTo1K34= +20250930025550.sql h1:+F+CsCUXD/ql0tHGEow70GhPBX1ZybVn+bh/T4YMh7Y= +20250930140351.sql h1:9AAEG1AnOAH+o0+oHL5G7I8vqlWOhwRlCGyyCpT/y1Q= +20251002085604.sql h1:3xZ68eYp4urXRnvotNH1XvG2mYOSDV/j3zHEZ/txg5E= +20251003032030.sql h1:HB+mQ2lXMNomHDpaRhB/9IwYI9/YiDO5eOJ+nAQH/jw= +20251005060450.sql h1:LbtCE2b+8osM3CvnmQJH1uCPtn+d7WchsslBOz8bL3Q= +20251006041122.sql h1:MlS7f21z06sutnf9dIekt5fuHJr4lgcQ4uCuCXAGsfc= +20251006045658.sql h1:3FmGCPCzjgMPdWDRodZTsx3KVaodd9zB9ilib69aewk= +20251006045928.sql h1:Z5g31PmnzNwk/OKdODcxZGm8fjJQdMFK32Xfnt3bRHg= +20251007022859.sql h1:FO03zEfaNEk/aXwY81d5Lp3MoBB9kPQuXlXJ4BPiSR8= +20251008031337.sql h1:l+sxUAGvcTfj3I6kAFHo+T6AYodC9k9GkR+jaKO2xXc= +20251008031554.sql h1:AqrVfIhSzY3PCy8ZlP5W91wn2iznfIuj5qQfubp6/94= +20251008052346.sql h1:nxnXmooIJ6r1mmzwnw+6efxLfc/k9h2aE6RMptPRons= +20251008073620.sql h1:6YsJp1W4SmQJ1lxpqF27BBlDC1zqhw7Yhc7pLzQTY6M= +20251009042854.sql h1:nkBV+R6j0fg7/JY6wH3eb5Vv0asJLnXmb6lINfT/GLQ= +20251009052657.sql h1:EPvdsib5rzCGPryd10HShGKvFPwM/R5S2lIVwtYxpms= +20251010031743.sql h1:T8IZmx8/btRFKLzTe78MzcBsPJNodnLvB0tby9QkirQ= +20251010070721.sql h1:5NQUk/yOV6sABLCB7swx++YIOyJe6MnU+yt1nRzde5w= +20251010072711.sql h1:ZJNqR2piyu8xJhBvVABSlnGEoKSKae3wuEs+wshPe4k= +20251013044536.sql h1:0Xjw8fNILiT8nnfrJDZgQnPf3dntmIoilbapnih8AE4= +20251013051438.sql h1:lfSuw5mgJnePBJamvhZ81osFIouXeiIEiSZ/evdwo48= +20251013081808.sql h1:ijgjNX08G6GBjA/ks8EKtb7P7Y7Cg7zbhqEOruGnv6M= +20251014060047.sql h1:0jqj49WTtneEIMQDBoo4c095ZGi8sCrA8NnHBrPU6D8= +20251014063537.sql h1:VZLXol0PTsTW21Epg6vBPsztWkDtcxup9F/z88EGgIg= +20251014063720.sql h1:2HVUyCV0ud3BJJDH2GEKZN/+IWLFPCsN1KqhP6csO14= +20251015045455.sql h1:MeLWmMhAOAz8b15Dd7IAQnt6JxjSml02XCXK22C0Lpg= +20251016010845.sql h1:4BncQdDOasRZJkzVJrSJJA7091A9VPNVx/faUCUPhBM= +20251016011023.sql h1:9JB9eFZKURK5RoCVDKR6glSvdJ8NTXrN7K/4q51zkz4= +20251016062912.sql h1:ACNn0fe+EMqUt3hoY+Dr3uqAV/QICBa1+mIW7fUc9Fk= +20251017060617.sql h1:4T3t9ifWrEQTPMSM0XJ98pF7Qdt+UfgtMui17bhrnWI= +20251017082207.sql h1:8vLG1l/saRRMHXkyA4nelJyjaSddhZd6r7R+Uo4JS/c= +20251018032635.sql h1:2xey5gnO3y2XSOrU8MLlIfoylPKbRGDRtHDD07B3MbQ= +20251018040322.sql h1:k/pdNiSoT8zFPqNQ/avOD0vYkNh3BTD64IlHrfVXr7I= +20251019093915.sql h1:hFcQE0y+p5dZiVwePGsRGto9m/q6kJNiUZbVDd5Rnjk= +20251020062553.sql h1:Iw7hulcm5iRQlfW+ygA4iTPxLqkxx6h9vXMXEwUAHKs= +20251021041042.sql h1:wMgSivBV2A0NDcsLmKGIp0kMcVh2IODSG9b4dgzCaOM= +20251021075552.sql h1:8gfSMAglflNO6L0sSzxFNEubYN8/O4thT7OQT+WH+3M= +20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA= +20251024034832.sql h1:x3s3VEVYLOSKLAFxJGb2+c1FyTMMvPE+9k4Ew7rKQaI= diff --git a/internal/domain/main-entities/division-position/base/entity.go b/internal/domain/main-entities/division-position/base/entity.go new file mode 100644 index 00000000..d44c0b86 --- /dev/null +++ b/internal/domain/main-entities/division-position/base/entity.go @@ -0,0 +1,18 @@ +package base + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type Basic struct { + ecore.SmallMain // adjust this according to the needs + Division_Id *uint16 `json:"division_id"` + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` +} + +func (Basic) TableName() string { + return "DivisionPosition" +} diff --git a/internal/domain/main-entities/division-position/entity.go b/internal/domain/main-entities/division-position/entity.go index c7d70968..79379b52 100644 --- a/internal/domain/main-entities/division-position/entity.go +++ b/internal/domain/main-entities/division-position/entity.go @@ -1,18 +1,13 @@ package divisionposition import ( - ecore "simrs-vx/internal/domain/base-entities/core" ed "simrs-vx/internal/domain/main-entities/division" + eb "simrs-vx/internal/domain/main-entities/division-position/base" ee "simrs-vx/internal/domain/main-entities/employee" ) type DivisionPosition struct { - ecore.SmallMain // adjust this according to the needs - Division_Id *uint16 `json:"division_id"` - Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"` - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - HeadStatus bool `json:"headStatus"` - Employee_Id *uint `json:"employee_id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + eb.Basic + Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` } diff --git a/internal/domain/main-entities/division/entity.go b/internal/domain/main-entities/division/entity.go index 470fab0d..4051c138 100644 --- a/internal/domain/main-entities/division/entity.go +++ b/internal/domain/main-entities/division/entity.go @@ -2,13 +2,15 @@ package division import ( ecore "simrs-vx/internal/domain/base-entities/core" + edpb "simrs-vx/internal/domain/main-entities/division-position/base" ) type Division struct { - ecore.SmallMain // adjust this according to the needs - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - Parent_Id *uint16 `json:"parent_id"` - Parent *Division `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"` - Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + Parent_Id *uint16 `json:"parent_id"` + Parent *Division `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"` + Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self + DivisionPositions []edpb.Basic `json:"divisionPositions,omitempty" gorm:"foreignKey:Division_Id;references:Id"` } diff --git a/internal/domain/main-entities/installation-position/base/entity.go b/internal/domain/main-entities/installation-position/base/entity.go new file mode 100644 index 00000000..02fbbe84 --- /dev/null +++ b/internal/domain/main-entities/installation-position/base/entity.go @@ -0,0 +1,20 @@ +package base + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/employee" +) + +type Basic struct { + ecore.SmallMain // adjust this according to the needs + Installation_Id *uint16 `json:"installation_id" gorm:"not null"` + Code string `json:"code" gorm:"unique;size:10;not null"` + Name string `json:"name" gorm:"size:30;not null"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` +} + +func (Basic) TableName() string { + return "InstallationPosition" +} diff --git a/internal/domain/main-entities/installation-position/entity.go b/internal/domain/main-entities/installation-position/entity.go index 03571326..48e95ac5 100644 --- a/internal/domain/main-entities/installation-position/entity.go +++ b/internal/domain/main-entities/installation-position/entity.go @@ -1,18 +1,11 @@ package installation_position import ( - ecore "simrs-vx/internal/domain/base-entities/core" - ee "simrs-vx/internal/domain/main-entities/employee" ei "simrs-vx/internal/domain/main-entities/installation" + eib "simrs-vx/internal/domain/main-entities/installation-position/base" ) type InstallationPosition struct { - ecore.SmallMain // adjust this according to the needs - Installation_Id *uint16 `json:"installation_id" gorm:"not null"` - Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"` - Code string `json:"code" gorm:"unique;size:10;not null"` - Name string `json:"name" gorm:"size:30;not null"` - HeadStatus bool `json:"headStatus"` - Employee_Id *uint `json:"employee_id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + eib.Basic // adjust this according to the needs + Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"` } diff --git a/internal/domain/main-entities/installation/entity.go b/internal/domain/main-entities/installation/entity.go index 0cd5b7dd..dea63a45 100644 --- a/internal/domain/main-entities/installation/entity.go +++ b/internal/domain/main-entities/installation/entity.go @@ -2,12 +2,14 @@ package installation import ( ecore "simrs-vx/internal/domain/base-entities/core" + eipb "simrs-vx/internal/domain/main-entities/installation-position/base" ere "simrs-vx/internal/domain/references/encounter" ) type Installation struct { - ecore.SmallMain // adjust this according to the needs - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"` + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"` + InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Id;references:Id"` } diff --git a/internal/domain/main-entities/specialist-position/base/entity.go b/internal/domain/main-entities/specialist-position/base/entity.go new file mode 100644 index 00000000..5910689e --- /dev/null +++ b/internal/domain/main-entities/specialist-position/base/entity.go @@ -0,0 +1,20 @@ +package base + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/employee" +) + +type Basic struct { + ecore.SmallMain // adjust this according to the needs + Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"` + Code string `json:"code" gorm:"unique;size:10;not null"` + Name string `json:"name" gorm:"size:30;not null"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` +} + +func (Basic) TableName() string { + return "SpecialistPosition" +} diff --git a/internal/domain/main-entities/specialist-position/entity.go b/internal/domain/main-entities/specialist-position/entity.go index 0afa5ba3..26c1d27f 100644 --- a/internal/domain/main-entities/specialist-position/entity.go +++ b/internal/domain/main-entities/specialist-position/entity.go @@ -1,18 +1,11 @@ package specialist_position import ( - ecore "simrs-vx/internal/domain/base-entities/core" - ee "simrs-vx/internal/domain/main-entities/employee" es "simrs-vx/internal/domain/main-entities/specialist" + esb "simrs-vx/internal/domain/main-entities/specialist-position/base" ) type SpecialistPosition struct { - ecore.SmallMain // adjust this according to the needs - Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"` - Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` - Code string `json:"code" gorm:"unique;size:10;not null"` - Name string `json:"name" gorm:"size:30;not null"` - HeadStatus bool `json:"headStatus"` - Employee_Id *uint `json:"employee_id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + esb.Basic + Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` } diff --git a/internal/domain/main-entities/specialist/entity.go b/internal/domain/main-entities/specialist/entity.go index 3cea2ebd..5c2d5b89 100644 --- a/internal/domain/main-entities/specialist/entity.go +++ b/internal/domain/main-entities/specialist/entity.go @@ -2,13 +2,15 @@ package specialist import ( ecore "simrs-vx/internal/domain/base-entities/core" + eub "simrs-vx/internal/domain/main-entities/specialist-position/base" eu "simrs-vx/internal/domain/main-entities/unit" ) type Specialist struct { - ecore.SmallMain // adjust this according to the needs - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - Unit_Id *uint16 `json:"unit_id"` - Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"` + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + Unit_Id *uint16 `json:"unit_id"` + Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"` + SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"` } diff --git a/internal/domain/main-entities/subspecialist-position/base/entity.go b/internal/domain/main-entities/subspecialist-position/base/entity.go new file mode 100644 index 00000000..147fcecb --- /dev/null +++ b/internal/domain/main-entities/subspecialist-position/base/entity.go @@ -0,0 +1,20 @@ +package base + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/employee" +) + +type Basic struct { + ecore.SmallMain // adjust this according to the needs + Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"` + Code string `json:"code" gorm:"unique;size:10;not null"` + Name string `json:"name" gorm:"size:30;not null"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` +} + +func (Basic) TableName() string { + return "SubspecialistPosition" +} diff --git a/internal/domain/main-entities/subspecialist-position/entity.go b/internal/domain/main-entities/subspecialist-position/entity.go index 5d4bdcb8..28a205ed 100644 --- a/internal/domain/main-entities/subspecialist-position/entity.go +++ b/internal/domain/main-entities/subspecialist-position/entity.go @@ -1,18 +1,11 @@ package subspecialist_position import ( - ecore "simrs-vx/internal/domain/base-entities/core" - ee "simrs-vx/internal/domain/main-entities/employee" es "simrs-vx/internal/domain/main-entities/subspecialist" + esb "simrs-vx/internal/domain/main-entities/subspecialist-position/base" ) type SubspecialistPosition struct { - ecore.SmallMain // adjust this according to the needs - Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"` - Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` - Code string `json:"code" gorm:"unique;size:10;not null"` - Name string `json:"name" gorm:"size:30;not null"` - HeadStatus bool `json:"headStatus"` - Employee_Id *uint `json:"employee_id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + esb.Basic + Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` } diff --git a/internal/domain/main-entities/subspecialist/entity.go b/internal/domain/main-entities/subspecialist/entity.go index 5de27442..a81d6ded 100644 --- a/internal/domain/main-entities/subspecialist/entity.go +++ b/internal/domain/main-entities/subspecialist/entity.go @@ -3,12 +3,14 @@ package subspecialist import ( ecore "simrs-vx/internal/domain/base-entities/core" es "simrs-vx/internal/domain/main-entities/specialist" + espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base" ) type Subspecialist struct { - ecore.SmallMain // adjust this according to the needs - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - Specialist_Id *uint16 `json:"specialist_id"` - Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"` + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + Specialist_Id *uint16 `json:"specialist_id"` + Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"` + SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"` } diff --git a/internal/domain/main-entities/unit-position/base/entity.go b/internal/domain/main-entities/unit-position/base/entity.go new file mode 100644 index 00000000..3d913d4f --- /dev/null +++ b/internal/domain/main-entities/unit-position/base/entity.go @@ -0,0 +1,18 @@ +package base + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type Basic struct { + ecore.SmallMain // adjust this according to the needs + Unit_Id *uint16 `json:"unit_id" gorm:"not null"` + Code string `json:"code" gorm:"unique;size:10;not null"` + Name string `json:"name" gorm:"size:30;not null"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` +} + +func (Basic) TableName() string { + return "UnitPosition" +} diff --git a/internal/domain/main-entities/unit-position/entity.go b/internal/domain/main-entities/unit-position/entity.go index 3bd10d9e..5450cee2 100644 --- a/internal/domain/main-entities/unit-position/entity.go +++ b/internal/domain/main-entities/unit-position/entity.go @@ -1,18 +1,13 @@ package unit_position import ( - ecore "simrs-vx/internal/domain/base-entities/core" ee "simrs-vx/internal/domain/main-entities/employee" eu "simrs-vx/internal/domain/main-entities/unit" + eub "simrs-vx/internal/domain/main-entities/unit-position/base" ) type UnitPosition struct { - ecore.SmallMain // adjust this according to the needs - Unit_Id *uint16 `json:"unit_id" gorm:"not null"` - Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` - Code string `json:"code" gorm:"unique;size:10;not null"` - Name string `json:"name" gorm:"size:30;not null"` - HeadStatus bool `json:"headStatus"` - Employee_Id *uint `json:"employee_id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + eub.Basic + Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` } diff --git a/internal/domain/main-entities/unit/entity.go b/internal/domain/main-entities/unit/entity.go index c86ad822..2142790f 100644 --- a/internal/domain/main-entities/unit/entity.go +++ b/internal/domain/main-entities/unit/entity.go @@ -3,6 +3,7 @@ package unit import ( ecore "simrs-vx/internal/domain/base-entities/core" ei "simrs-vx/internal/domain/main-entities/installation" + eub "simrs-vx/internal/domain/main-entities/unit-position/base" ero "simrs-vx/internal/domain/references/organization" ) @@ -13,4 +14,5 @@ type Unit struct { Code string `json:"code" gorm:"unique;size:10"` Name string `json:"name" gorm:"size:50"` Type_Code *ero.UnitTypeCode `json:"type_code"` + UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` } From e36114655fdbe75e4db48bcd612c45b688b8a312 Mon Sep 17 00:00:00 2001 From: Munawwirul Jamal Date: Fri, 24 Oct 2025 12:55:17 +0700 Subject: [PATCH 3/9] migration: added system const --- internal/domain/references/organization/organization.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/domain/references/organization/organization.go b/internal/domain/references/organization/organization.go index 0309cbee..1dfe93ad 100644 --- a/internal/domain/references/organization/organization.go +++ b/internal/domain/references/organization/organization.go @@ -11,6 +11,7 @@ type ( ) const ( + CSCSys ContractPositionCode = "system" // System CSCEmp ContractPositionCode = "employee" // Pegawai CSCInt ContractPositionCode = "intern" // PPDS From cdae478152a8b8e6229871fc3f6f9b79a0b142f8 Mon Sep 17 00:00:00 2001 From: vanilia Date: Fri, 24 Oct 2025 14:41:41 +0700 Subject: [PATCH 4/9] adjustment detail division --- internal/domain/main-entities/division/dto.go | 49 +++++++++++++++---- .../domain/main-entities/installation/dto.go | 5 +- internal/domain/main-entities/unit/dto.go | 1 + .../main-handler/division/handler.go | 2 + .../use-case/main-use-case/division/case.go | 46 +++++++++++++++-- .../use-case/main-use-case/division/lib.go | 4 +- 6 files changed, 91 insertions(+), 16 deletions(-) diff --git a/internal/domain/main-entities/division/dto.go b/internal/domain/main-entities/division/dto.go index 95ea9119..d82380a0 100644 --- a/internal/domain/main-entities/division/dto.go +++ b/internal/domain/main-entities/division/dto.go @@ -2,6 +2,10 @@ package division import ( ecore "simrs-vx/internal/domain/base-entities/core" + ep "simrs-vx/internal/domain/main-entities/person" + eu "simrs-vx/internal/domain/main-entities/user" + erc "simrs-vx/internal/domain/references/common" + erg "simrs-vx/internal/domain/references/organization" ) type CreateDto struct { @@ -26,8 +30,9 @@ type FilterDto struct { } type ReadDetailDto struct { - Id uint16 `json:"id"` - Code *string `json:"code"` + Id uint16 `json:"id"` + Code *string `json:"code"` + Includes string `json:"includes"` } type UpdateDto struct { @@ -47,14 +52,36 @@ type MetaDto struct { type ResponseDto struct { ecore.SmallMain - Code string `json:"code"` - Name string `json:"name"` - Parent_Id *uint16 `json:"parent_id"` - Parent *Division `json:"parent,omitempty"` - Childrens []Division `json:"childrens,omitempty"` + Code string `json:"code"` + Name string `json:"name"` + Parent_Id *uint16 `json:"parent_id"` + Parent *Division `json:"parent,omitempty"` + Childrens []Division `json:"childrens,omitempty"` + DivisionPosition []ResponseDivisionPosition `json:"divisionPositions,omitempty"` } -func (d Division) ToResponse() ResponseDto { +type ResponseDivisionPosition struct { + ecore.SmallMain // adjust this according to the needs + Division_Id *uint16 `json:"division_id"` + Code string `json:"code"` + Name string `json:"name"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` + Employee ResponseDivisionEmployee `json:"employee"` +} + +type ResponseDivisionEmployee struct { + ecore.Main // adjust this according to the needs + User_Id *uint `json:"user_id"` + User *eu.User `json:"user,omitempty"` + Person_Id *uint `json:"person_id"` + Person *ep.Person `json:"person,omitempty"` + Position_Code *erg.EmployeePositionCode `json:"position_code"` + Number *string `json:"number"` + Status_Code erc.ActiveStatusCode `json:"status_code"` +} + +func (d Division) ToResponse(divPos []ResponseDivisionPosition) ResponseDto { resp := ResponseDto{ Code: d.Code, Name: d.Name, @@ -63,13 +90,17 @@ func (d Division) ToResponse() ResponseDto { Childrens: d.Childrens, } resp.SmallMain = d.SmallMain + + if divPos != nil { + resp.DivisionPosition = divPos + } return resp } func ToResponseList(data []Division) []ResponseDto { resp := make([]ResponseDto, len(data)) for i, u := range data { - resp[i] = u.ToResponse() + resp[i] = u.ToResponse(nil) } return resp } diff --git a/internal/domain/main-entities/installation/dto.go b/internal/domain/main-entities/installation/dto.go index 55981981..24c75beb 100644 --- a/internal/domain/main-entities/installation/dto.go +++ b/internal/domain/main-entities/installation/dto.go @@ -27,8 +27,9 @@ type FilterDto struct { } type ReadDetailDto struct { - Id uint16 `json:"id"` - Code *string `json:"code"` + Id uint16 `json:"id"` + Code *string `json:"code"` + Includes string `json:"includes"` } type UpdateDto struct { diff --git a/internal/domain/main-entities/unit/dto.go b/internal/domain/main-entities/unit/dto.go index 10960609..e294d950 100644 --- a/internal/domain/main-entities/unit/dto.go +++ b/internal/domain/main-entities/unit/dto.go @@ -29,6 +29,7 @@ type ReadDetailDto struct { Id uint16 `json:"id"` Installation_Id *uint16 `json:"installation_id"` Code *string `json:"code"` + Includes string `json:"includes"` } type UpdateDto struct { diff --git a/internal/interface/main-handler/division/handler.go b/internal/interface/main-handler/division/handler.go index 94940f55..ee4cbea5 100644 --- a/internal/interface/main-handler/division/handler.go +++ b/internal/interface/main-handler/division/handler.go @@ -37,7 +37,9 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { if id <= 0 { return } + dto := e.ReadDetailDto{} + sf.UrlQueryParam(&dto, *r.URL) dto.Id = uint16(id) res, err := u.ReadDetail(dto) rw.DataResponse(w, res, err) diff --git a/internal/use-case/main-use-case/division/case.go b/internal/use-case/main-use-case/division/case.go index daabd2f8..3f0353ae 100644 --- a/internal/use-case/main-use-case/division/case.go +++ b/internal/use-case/main-use-case/division/case.go @@ -2,8 +2,11 @@ package division import ( e "simrs-vx/internal/domain/main-entities/division" + edp "simrs-vx/internal/domain/main-entities/division-position" "strconv" + udp "simrs-vx/internal/use-case/main-use-case/division-position" + dg "github.com/karincake/apem/db-gorm-pg" d "github.com/karincake/dodol" @@ -61,7 +64,7 @@ func Create(input e.CreateDto) (*d.Data, error) { "structure": "single-data", "status": "created", }, - Data: data.ToResponse(), + Data: data.ToResponse(nil), }, nil } @@ -121,6 +124,7 @@ func ReadList(input e.ReadListDto) (*d.Data, error) { func ReadDetail(input e.ReadDetailDto) (*d.Data, error) { var data *e.Division var err error + var dataDP []e.ResponseDivisionPosition event := pl.Event{ Feature: "ReadDetail", @@ -142,6 +146,40 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) { return err } + // get data divisionPositions + dataDivisionPosition, err := udp.ReadList(edp.ReadListDto{ + FilterDto: edp.FilterDto{ + Division_Id: &input.Id, + }, + Includes: "employee,employee.User", + }) + if err != nil { + return err + } + + list, _ := dataDivisionPosition.Data.([]edp.ResponseDto) + if len(list) > 0 { + for _, dp := range list { + dataDP = append(dataDP, e.ResponseDivisionPosition{ + SmallMain: dp.SmallMain, + Division_Id: &dp.Id, + Code: dp.Code, + Name: dp.Name, + HeadStatus: dp.HeadStatus, + Employee_Id: dp.Employee_Id, + Employee: e.ResponseDivisionEmployee{ + Main: dp.Employee.Main, + User_Id: dp.Employee.User_Id, + User: dp.Employee.User, + Person_Id: dp.Employee.Person_Id, + Person: dp.Employee.Person, + Number: dp.Employee.Number, + Status_Code: dp.Employee.Status_Code, + }, + }) + } + } + mwRunner.setMwType(pu.MWTPost) // Run post-middleware if err := mwRunner.RunReadDetailMiddleware(readDetailPostMw, &input, data); err != nil { @@ -161,7 +199,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) { "structure": "single-data", "status": "fetched", }, - Data: data.ToResponse(), + Data: data.ToResponse(dataDP), }, nil } @@ -216,7 +254,7 @@ func Update(input e.UpdateDto) (*d.Data, error) { "structure": "single-data", "status": "updated", }, - Data: data.ToResponse(), + Data: data.ToResponse(nil), }, nil } @@ -270,7 +308,7 @@ func Delete(input e.DeleteDto) (*d.Data, error) { "structure": "single-data", "status": "deleted", }, - Data: data.ToResponse(), + Data: data.ToResponse(nil), }, nil } diff --git a/internal/use-case/main-use-case/division/lib.go b/internal/use-case/main-use-case/division/lib.go index 828395e7..56ce34f7 100644 --- a/internal/use-case/main-use-case/division/lib.go +++ b/internal/use-case/main-use-case/division/lib.go @@ -91,7 +91,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e tx = dg.I } - if err := tx.First(&data, input.Id).Error; err != nil { + if err := tx. + Scopes(gh.Preload(input.Includes)). + First(&data, input.Id).Error; err != nil { if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil { return nil, processedErr } From fa1374484a3ea098b361da1a13eaa3bdd6cf7a77 Mon Sep 17 00:00:00 2001 From: vanilia Date: Fri, 24 Oct 2025 14:44:04 +0700 Subject: [PATCH 5/9] remove division in employee --- cmd/main-migration/migrations/20251024074315.sql | 2 ++ cmd/main-migration/migrations/atlas.sum | 3 ++- internal/domain/main-entities/employee/dto.go | 14 ++++++-------- internal/domain/main-entities/employee/entity.go | 3 --- 4 files changed, 10 insertions(+), 12 deletions(-) create mode 100644 cmd/main-migration/migrations/20251024074315.sql diff --git a/cmd/main-migration/migrations/20251024074315.sql b/cmd/main-migration/migrations/20251024074315.sql new file mode 100644 index 00000000..99b3b76b --- /dev/null +++ b/cmd/main-migration/migrations/20251024074315.sql @@ -0,0 +1,2 @@ +-- Modify "Employee" table +ALTER TABLE "public"."Employee" DROP COLUMN "Division_Code"; diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index a52827a6..9f6394ae 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:fAJxBGCfoMXYDjYBlq6RITZ/dXbqiYtQWwupcBMLHV0= +h1:XE6wCH2XnIm3XpP9itgkMFv8CCrc2SOb51W/bA5h3Uk= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -57,3 +57,4 @@ h1:fAJxBGCfoMXYDjYBlq6RITZ/dXbqiYtQWwupcBMLHV0= 20251021075552.sql h1:8gfSMAglflNO6L0sSzxFNEubYN8/O4thT7OQT+WH+3M= 20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA= 20251024034832.sql h1:x3s3VEVYLOSKLAFxJGb2+c1FyTMMvPE+9k4Ew7rKQaI= +20251024074315.sql h1:GkocUmXpU1QiZpjvELK4e6sKASxiS3kZTk+35Iux2ds= diff --git a/internal/domain/main-entities/employee/dto.go b/internal/domain/main-entities/employee/dto.go index 9e0e93d2..ff8f6adf 100644 --- a/internal/domain/main-entities/employee/dto.go +++ b/internal/domain/main-entities/employee/dto.go @@ -68,14 +68,12 @@ type ResponseDto struct { func (d Employee) ToResponse() ResponseDto { resp := ResponseDto{ - User_Id: d.User_Id, - User: d.User, - Person_Id: d.Person_Id, - Person: d.Person, - Division_Code: d.Division_Code, - Division: d.Division, - Number: d.Number, - Status_Code: d.Status_Code, + User_Id: d.User_Id, + User: d.User, + Person_Id: d.Person_Id, + Person: d.Person, + Number: d.Number, + Status_Code: d.Status_Code, } resp.Main = d.Main return resp diff --git a/internal/domain/main-entities/employee/entity.go b/internal/domain/main-entities/employee/entity.go index 1177abe9..7a770be0 100644 --- a/internal/domain/main-entities/employee/entity.go +++ b/internal/domain/main-entities/employee/entity.go @@ -2,7 +2,6 @@ package employee import ( ecore "simrs-vx/internal/domain/base-entities/core" - ed "simrs-vx/internal/domain/main-entities/division" ep "simrs-vx/internal/domain/main-entities/person" eu "simrs-vx/internal/domain/main-entities/user" erc "simrs-vx/internal/domain/references/common" @@ -16,8 +15,6 @@ type Employee struct { Person_Id *uint `json:"person_id"` Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"` Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"` - Division_Code *string `json:"division_code"` - Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"` Number *string `json:"number" gorm:"size:20"` Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"` } From 49f0509273fafd5e91861d968109fb4abf98d717 Mon Sep 17 00:00:00 2001 From: vanilia Date: Fri, 24 Oct 2025 14:53:44 +0700 Subject: [PATCH 6/9] adjustment division-position --- .../division-position/base/entity.go | 14 ++++++----- .../main-entities/division-position/entity.go | 2 -- internal/domain/main-entities/employee/dto.go | 25 ++++++++----------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/internal/domain/main-entities/division-position/base/entity.go b/internal/domain/main-entities/division-position/base/entity.go index d44c0b86..ce8f3175 100644 --- a/internal/domain/main-entities/division-position/base/entity.go +++ b/internal/domain/main-entities/division-position/base/entity.go @@ -2,15 +2,17 @@ package base import ( ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/employee" ) type Basic struct { - ecore.SmallMain // adjust this according to the needs - Division_Id *uint16 `json:"division_id"` - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - HeadStatus bool `json:"headStatus"` - Employee_Id *uint `json:"employee_id"` + ecore.SmallMain // adjust this according to the needs + Division_Id *uint16 `json:"division_id"` + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` } func (Basic) TableName() string { diff --git a/internal/domain/main-entities/division-position/entity.go b/internal/domain/main-entities/division-position/entity.go index 79379b52..d71ba01c 100644 --- a/internal/domain/main-entities/division-position/entity.go +++ b/internal/domain/main-entities/division-position/entity.go @@ -3,11 +3,9 @@ package divisionposition import ( ed "simrs-vx/internal/domain/main-entities/division" eb "simrs-vx/internal/domain/main-entities/division-position/base" - ee "simrs-vx/internal/domain/main-entities/employee" ) type DivisionPosition struct { eb.Basic Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` } diff --git a/internal/domain/main-entities/employee/dto.go b/internal/domain/main-entities/employee/dto.go index ff8f6adf..d11ccae0 100644 --- a/internal/domain/main-entities/employee/dto.go +++ b/internal/domain/main-entities/employee/dto.go @@ -2,7 +2,6 @@ package employee import ( ecore "simrs-vx/internal/domain/base-entities/core" - ed "simrs-vx/internal/domain/main-entities/division" ep "simrs-vx/internal/domain/main-entities/person" eu "simrs-vx/internal/domain/main-entities/user" @@ -10,11 +9,10 @@ import ( ) type CreateDto struct { - User_Id *uint `json:"user_id"` - Person_Id *uint `json:"person_id"` - Division_Code *string `json:"division_code"` - Number *string `json:"number" validate:"maxLength=20"` - Status_Code erc.ActiveStatusCode `json:"status_code" validate:"maxLength=10"` + User_Id *uint `json:"user_id"` + Person_Id *uint `json:"person_id"` + Number *string `json:"number" validate:"maxLength=20"` + Status_Code erc.ActiveStatusCode `json:"status_code" validate:"maxLength=10"` } type ReadListDto struct { @@ -26,7 +24,6 @@ type ReadListDto struct { type FilterDto struct { User_Id *uint `json:"user-id"` Person_Id *uint `json:"person-id"` - Division_Code *string `json:"division-code"` Position_Code *string `json:"position-code"` Number *string `json:"number"` Status_Code erc.ActiveStatusCode `json:"status-code"` @@ -56,14 +53,12 @@ type MetaDto struct { type ResponseDto struct { ecore.Main - User_Id *uint `json:"user_id"` - User *eu.User `json:"user,omitempty"` - Person_Id *uint `json:"person_id"` - Person *ep.Person `json:"person,omitempty"` - Division_Code *string `json:"division_code"` - Division *ed.Division `json:"division,omitempty"` - Number *string `json:"number"` - Status_Code erc.ActiveStatusCode `json:"status_code"` + User_Id *uint `json:"user_id"` + User *eu.User `json:"user,omitempty"` + Person_Id *uint `json:"person_id"` + Person *ep.Person `json:"person,omitempty"` + Number *string `json:"number"` + Status_Code erc.ActiveStatusCode `json:"status_code"` } func (d Employee) ToResponse() ResponseDto { From 69f80b45ef5a496dacc8fefb6580535aa94c26a5 Mon Sep 17 00:00:00 2001 From: vanilia Date: Fri, 24 Oct 2025 15:39:14 +0700 Subject: [PATCH 7/9] adjustment detail installation --- internal/domain/main-entities/employee/dto.go | 10 +++-- .../domain/main-entities/installation/dto.go | 15 ++++--- internal/domain/main-entities/unit/dto.go | 7 ++- .../main-handler/installation/handler.go | 2 + .../interface/main-handler/unit/handler.go | 2 + .../main-use-case/authentication/case.go | 12 ++--- .../use-case/main-use-case/division/case.go | 45 ++----------------- .../use-case/main-use-case/employee/helper.go | 1 - .../main-use-case/installation/lib.go | 4 +- internal/use-case/main-use-case/unit/lib.go | 4 +- .../use-case/main-use-case/user/helper.go | 1 - 11 files changed, 40 insertions(+), 63 deletions(-) diff --git a/internal/domain/main-entities/employee/dto.go b/internal/domain/main-entities/employee/dto.go index d11ccae0..85b7008a 100644 --- a/internal/domain/main-entities/employee/dto.go +++ b/internal/domain/main-entities/employee/dto.go @@ -6,13 +6,15 @@ import ( eu "simrs-vx/internal/domain/main-entities/user" erc "simrs-vx/internal/domain/references/common" + erg "simrs-vx/internal/domain/references/organization" ) type CreateDto struct { - User_Id *uint `json:"user_id"` - Person_Id *uint `json:"person_id"` - Number *string `json:"number" validate:"maxLength=20"` - Status_Code erc.ActiveStatusCode `json:"status_code" validate:"maxLength=10"` + User_Id *uint `json:"user_id"` + Person_Id *uint `json:"person_id"` + Number *string `json:"number" validate:"maxLength=20"` + Status_Code erc.ActiveStatusCode `json:"status_code" validate:"maxLength=10"` + Position_Code *erg.EmployeePositionCode `json:"position_code"` } type ReadListDto struct { diff --git a/internal/domain/main-entities/installation/dto.go b/internal/domain/main-entities/installation/dto.go index 24c75beb..302025d8 100644 --- a/internal/domain/main-entities/installation/dto.go +++ b/internal/domain/main-entities/installation/dto.go @@ -2,6 +2,7 @@ package installation import ( ecore "simrs-vx/internal/domain/base-entities/core" + eipb "simrs-vx/internal/domain/main-entities/installation-position/base" ere "simrs-vx/internal/domain/references/encounter" ) @@ -49,16 +50,18 @@ type MetaDto struct { type ResponseDto struct { ecore.SmallMain - Code string `json:"code"` - Name string `json:"name"` - EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"` + Code string `json:"code"` + Name string `json:"name"` + EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"` + InstallationPositions []eipb.Basic `json:"installationPositions,omitempty"` } func (d Installation) ToResponse() ResponseDto { resp := ResponseDto{ - Code: d.Code, - Name: d.Name, - EncounterClass_Code: d.EncounterClass_Code, + Code: d.Code, + Name: d.Name, + EncounterClass_Code: d.EncounterClass_Code, + InstallationPositions: d.InstallationPositions, } resp.SmallMain = d.SmallMain return resp diff --git a/internal/domain/main-entities/unit/dto.go b/internal/domain/main-entities/unit/dto.go index e294d950..ce1dd505 100644 --- a/internal/domain/main-entities/unit/dto.go +++ b/internal/domain/main-entities/unit/dto.go @@ -3,6 +3,7 @@ package unit import ( ecore "simrs-vx/internal/domain/base-entities/core" ei "simrs-vx/internal/domain/main-entities/installation" + eipb "simrs-vx/internal/domain/main-entities/unit-position/base" ) type CreateDto struct { @@ -51,8 +52,9 @@ type ResponseDto struct { ecore.SmallMain Installation_Id *uint16 `json:"installation_id"` Installation *ei.Installation - Code string `json:"code"` - Name string `json:"name"` + Code string `json:"code"` + Name string `json:"name"` + UnitPositions []eipb.Basic `json:"unitPositions,omitempty"` } func (d Unit) ToResponse() ResponseDto { @@ -60,6 +62,7 @@ func (d Unit) ToResponse() ResponseDto { Installation_Id: d.Installation_Id, Code: d.Code, Name: d.Name, + UnitPositions: d.UnitPositions, } resp.SmallMain = d.SmallMain if d.Installation != nil { diff --git a/internal/interface/main-handler/installation/handler.go b/internal/interface/main-handler/installation/handler.go index dd5903f8..26885689 100644 --- a/internal/interface/main-handler/installation/handler.go +++ b/internal/interface/main-handler/installation/handler.go @@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { return } dto := e.ReadDetailDto{} + + sf.UrlQueryParam(&dto, *r.URL) dto.Id = uint16(id) res, err := u.ReadDetail(dto) rw.DataResponse(w, res, err) diff --git a/internal/interface/main-handler/unit/handler.go b/internal/interface/main-handler/unit/handler.go index 0abc9a21..a94ce74e 100644 --- a/internal/interface/main-handler/unit/handler.go +++ b/internal/interface/main-handler/unit/handler.go @@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { return } dto := e.ReadDetailDto{} + + sf.UrlQueryParam(&dto, *r.URL) dto.Id = uint16(id) res, err := u.ReadDetail(dto) rw.DataResponse(w, res, err) diff --git a/internal/use-case/main-use-case/authentication/case.go b/internal/use-case/main-use-case/authentication/case.go index da454333..5b9952a3 100644 --- a/internal/use-case/main-use-case/authentication/case.go +++ b/internal/use-case/main-use-case/authentication/case.go @@ -120,10 +120,10 @@ func GenToken(input eu.LoginDto) (*d.Data, error) { outputData["employee_id"] = employee.Id role = append(role, "emp-"+string(*employee.Position_Code)) - if employee.Division_Code != nil { - atClaims["employee_division_code"] = employee.Division_Code - outputData["employee_division_code"] = employee.Division_Code - } + //if employee.Division_Code != nil { + // atClaims["employee_division_code"] = employee.Division_Code + // outputData["employee_division_code"] = employee.Division_Code + //} // employee position if employee.Id > 0 && employee.Position_Code != nil { @@ -159,7 +159,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) { errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}} // division position - divsionPositions, err := getDivisionPosition(employee.Id) + divisionPositions, err := getDivisionPosition(employee.Id) if err != nil { return nil, errorGetPosition } @@ -188,7 +188,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) { return nil, errorGetPosition } - role = append(role, divsionPositions...) + role = append(role, divisionPositions...) role = append(role, installationPositions...) role = append(role, unitPositions...) role = append(role, specialistPositions...) diff --git a/internal/use-case/main-use-case/division/case.go b/internal/use-case/main-use-case/division/case.go index 9699e124..daabd2f8 100644 --- a/internal/use-case/main-use-case/division/case.go +++ b/internal/use-case/main-use-case/division/case.go @@ -2,11 +2,8 @@ package division import ( e "simrs-vx/internal/domain/main-entities/division" - edp "simrs-vx/internal/domain/main-entities/division-position" "strconv" - udp "simrs-vx/internal/use-case/main-use-case/division-position" - dg "github.com/karincake/apem/db-gorm-pg" d "github.com/karincake/dodol" @@ -64,7 +61,7 @@ func Create(input e.CreateDto) (*d.Data, error) { "structure": "single-data", "status": "created", }, - Data: data.ToResponse(nil), + Data: data.ToResponse(), }, nil } @@ -145,40 +142,6 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) { return err } - // get data divisionPositions - dataDivisionPosition, err := udp.ReadList(edp.ReadListDto{ - FilterDto: edp.FilterDto{ - Division_Id: &input.Id, - }, - Includes: "employee,employee.User", - }) - if err != nil { - return err - } - - list, _ := dataDivisionPosition.Data.([]edp.ResponseDto) - if len(list) > 0 { - for _, dp := range list { - dataDP = append(dataDP, e.ResponseDivisionPosition{ - SmallMain: dp.SmallMain, - Division_Id: &dp.Id, - Code: dp.Code, - Name: dp.Name, - HeadStatus: dp.HeadStatus, - Employee_Id: dp.Employee_Id, - Employee: e.ResponseDivisionEmployee{ - Main: dp.Employee.Main, - User_Id: dp.Employee.User_Id, - User: dp.Employee.User, - Person_Id: dp.Employee.Person_Id, - Person: dp.Employee.Person, - Number: dp.Employee.Number, - Status_Code: dp.Employee.Status_Code, - }, - }) - } - } - mwRunner.setMwType(pu.MWTPost) // Run post-middleware if err := mwRunner.RunReadDetailMiddleware(readDetailPostMw, &input, data); err != nil { @@ -198,7 +161,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) { "structure": "single-data", "status": "fetched", }, - Data: data.ToResponse(dataDP), + Data: data.ToResponse(), }, nil } @@ -253,7 +216,7 @@ func Update(input e.UpdateDto) (*d.Data, error) { "structure": "single-data", "status": "updated", }, - Data: data.ToResponse(nil), + Data: data.ToResponse(), }, nil } @@ -307,7 +270,7 @@ func Delete(input e.DeleteDto) (*d.Data, error) { "structure": "single-data", "status": "deleted", }, - Data: data.ToResponse(nil), + Data: data.ToResponse(), }, nil } diff --git a/internal/use-case/main-use-case/employee/helper.go b/internal/use-case/main-use-case/employee/helper.go index b0202c08..e13ce535 100644 --- a/internal/use-case/main-use-case/employee/helper.go +++ b/internal/use-case/main-use-case/employee/helper.go @@ -19,7 +19,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Employee) { data.User_Id = inputSrc.User_Id data.Person_Id = inputSrc.Person_Id - data.Division_Code = inputSrc.Division_Code data.Number = inputSrc.Number data.Status_Code = inputSrc.Status_Code data.Position_Code = inputSrc.Position_Code diff --git a/internal/use-case/main-use-case/installation/lib.go b/internal/use-case/main-use-case/installation/lib.go index fd0158ee..82130c32 100644 --- a/internal/use-case/main-use-case/installation/lib.go +++ b/internal/use-case/main-use-case/installation/lib.go @@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e tx = dg.I } - if err := tx.First(&data, input.Id).Error; err != nil { + if err := tx. + Scopes(gh.Preload(input.Includes)). + First(&data, input.Id).Error; err != nil { if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil { return nil, processedErr } diff --git a/internal/use-case/main-use-case/unit/lib.go b/internal/use-case/main-use-case/unit/lib.go index c79c1373..1a3e5652 100644 --- a/internal/use-case/main-use-case/unit/lib.go +++ b/internal/use-case/main-use-case/unit/lib.go @@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e tx = dg.I } - if err := tx.First(&data, input.Id).Error; err != nil { + if err := tx. + Scopes(gh.Preload(input.Includes)). + First(&data, input.Id).Error; err != nil { if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil { return nil, processedErr } diff --git a/internal/use-case/main-use-case/user/helper.go b/internal/use-case/main-use-case/user/helper.go index cb640dcb..acb32331 100644 --- a/internal/use-case/main-use-case/user/helper.go +++ b/internal/use-case/main-use-case/user/helper.go @@ -46,7 +46,6 @@ func setDataEmployeeUpdate(src e.EmployeUpdateDto) ee.UpdateDto { CreateDto: ee.CreateDto{ User_Id: src.User_Id, Person_Id: src.Person_Id, - Division_Code: src.Division_Code, Number: src.Number, Status_Code: src.Status_Code, Position_Code: &src.Position_Code, From d70a0a47f3f6d5554ae54395bf7ed04561d720f1 Mon Sep 17 00:00:00 2001 From: vanilia Date: Fri, 24 Oct 2025 15:41:26 +0700 Subject: [PATCH 8/9] adjustment unit-position entity --- cmd/main-migration/migrations/atlas.sum | 4 ++-- .../main-entities/unit-position/base/entity.go | 14 ++++++++------ .../domain/main-entities/unit-position/entity.go | 4 +--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 9f6394ae..9a03ed9b 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:XE6wCH2XnIm3XpP9itgkMFv8CCrc2SOb51W/bA5h3Uk= +h1:ieMeKh35/dro1YBBO11ZP0nZan9aJ5aFSqnEAi+T+WQ= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -57,4 +57,4 @@ h1:XE6wCH2XnIm3XpP9itgkMFv8CCrc2SOb51W/bA5h3Uk= 20251021075552.sql h1:8gfSMAglflNO6L0sSzxFNEubYN8/O4thT7OQT+WH+3M= 20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA= 20251024034832.sql h1:x3s3VEVYLOSKLAFxJGb2+c1FyTMMvPE+9k4Ew7rKQaI= -20251024074315.sql h1:GkocUmXpU1QiZpjvELK4e6sKASxiS3kZTk+35Iux2ds= +20251024074315.sql h1:EjAjelgi5qAfcRq/8vPTlGGYHvAKxNTllm8f0SzZDns= diff --git a/internal/domain/main-entities/unit-position/base/entity.go b/internal/domain/main-entities/unit-position/base/entity.go index 3d913d4f..b8e6a63a 100644 --- a/internal/domain/main-entities/unit-position/base/entity.go +++ b/internal/domain/main-entities/unit-position/base/entity.go @@ -2,15 +2,17 @@ package base import ( ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/employee" ) type Basic struct { - ecore.SmallMain // adjust this according to the needs - Unit_Id *uint16 `json:"unit_id" gorm:"not null"` - Code string `json:"code" gorm:"unique;size:10;not null"` - Name string `json:"name" gorm:"size:30;not null"` - HeadStatus bool `json:"headStatus"` - Employee_Id *uint `json:"employee_id"` + ecore.SmallMain // adjust this according to the needs + Unit_Id *uint16 `json:"unit_id" gorm:"not null"` + Code string `json:"code" gorm:"unique;size:10;not null"` + Name string `json:"name" gorm:"size:30;not null"` + HeadStatus bool `json:"headStatus"` + Employee_Id *uint `json:"employee_id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` } func (Basic) TableName() string { diff --git a/internal/domain/main-entities/unit-position/entity.go b/internal/domain/main-entities/unit-position/entity.go index 5450cee2..9966cd4a 100644 --- a/internal/domain/main-entities/unit-position/entity.go +++ b/internal/domain/main-entities/unit-position/entity.go @@ -1,13 +1,11 @@ package unit_position import ( - ee "simrs-vx/internal/domain/main-entities/employee" eu "simrs-vx/internal/domain/main-entities/unit" eub "simrs-vx/internal/domain/main-entities/unit-position/base" ) type UnitPosition struct { eub.Basic - Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` - Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"` } From bc76f9e98599a2e3c01519b8b9c72967bce3eb4a Mon Sep 17 00:00:00 2001 From: vanilia Date: Fri, 24 Oct 2025 16:04:09 +0700 Subject: [PATCH 9/9] adjustment detail installation,specialis, subspecialist --- .../domain/main-entities/specialist/dto.go | 20 +++++++++++-------- .../domain/main-entities/subspecialist/dto.go | 14 ++++++++----- .../main-handler/specialist/handler.go | 2 ++ .../main-handler/subspecialist/handler.go | 2 ++ .../use-case/main-use-case/specialist/lib.go | 4 +++- .../main-use-case/subspecialist/lib.go | 4 +++- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/internal/domain/main-entities/specialist/dto.go b/internal/domain/main-entities/specialist/dto.go index f1338c19..3fa6bf5e 100644 --- a/internal/domain/main-entities/specialist/dto.go +++ b/internal/domain/main-entities/specialist/dto.go @@ -2,6 +2,7 @@ package specialist import ( ecore "simrs-vx/internal/domain/base-entities/core" + espb "simrs-vx/internal/domain/main-entities/specialist-position/base" ) type CreateDto struct { @@ -25,8 +26,9 @@ type FilterDto struct { } type ReadDetailDto struct { - Id uint16 `json:"id"` - Code *string `json:"code"` + Id uint16 `json:"id"` + Code *string `json:"code"` + Includes string `json:"includes"` } type UpdateDto struct { @@ -46,16 +48,18 @@ type MetaDto struct { type ResponseDto struct { ecore.SmallMain - Code string `json:"code"` - Name string `json:"name"` - Unit_Id *uint16 `json:"unit_id"` + Code string `json:"code"` + Name string `json:"name"` + Unit_Id *uint16 `json:"unit_id"` + SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"` } func (d Specialist) ToResponse() ResponseDto { resp := ResponseDto{ - Code: d.Code, - Name: d.Name, - Unit_Id: d.Unit_Id, + Code: d.Code, + Name: d.Name, + Unit_Id: d.Unit_Id, + SpecialistPositions: d.SpecialistPositions, } resp.SmallMain = d.SmallMain return resp diff --git a/internal/domain/main-entities/subspecialist/dto.go b/internal/domain/main-entities/subspecialist/dto.go index e28f96ae..ed0c97aa 100644 --- a/internal/domain/main-entities/subspecialist/dto.go +++ b/internal/domain/main-entities/subspecialist/dto.go @@ -2,6 +2,7 @@ package subspecialist import ( ecore "simrs-vx/internal/domain/base-entities/core" + espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base" ) type CreateDto struct { @@ -25,8 +26,9 @@ type FilterDto struct { } type ReadDetailDto struct { - Id uint16 `json:"id"` - Code *string `json:"code"` + Id uint16 `json:"id"` + Code *string `json:"code"` + Includes string `json:"includes"` } type UpdateDto struct { @@ -46,9 +48,10 @@ type MetaDto struct { type ResponseDto struct { ecore.SmallMain - Code string `json:"code"` - Name string `json:"name"` - Specialist_Id *uint16 `json:"specialist_id"` + Code string `json:"code"` + Name string `json:"name"` + Specialist_Id *uint16 `json:"specialist_id"` + Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"` } func (d Subspecialist) ToResponse() ResponseDto { @@ -56,6 +59,7 @@ func (d Subspecialist) ToResponse() ResponseDto { Code: d.Code, Name: d.Name, Specialist_Id: d.Specialist_Id, + Subspecialist: d.SubspecialistPositions, } resp.SmallMain = d.SmallMain return resp diff --git a/internal/interface/main-handler/specialist/handler.go b/internal/interface/main-handler/specialist/handler.go index 561d07d0..d3a074d8 100644 --- a/internal/interface/main-handler/specialist/handler.go +++ b/internal/interface/main-handler/specialist/handler.go @@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { return } dto := e.ReadDetailDto{} + + sf.UrlQueryParam(&dto, *r.URL) dto.Id = uint16(id) res, err := u.ReadDetail(dto) rw.DataResponse(w, res, err) diff --git a/internal/interface/main-handler/subspecialist/handler.go b/internal/interface/main-handler/subspecialist/handler.go index d639c115..c4b933b4 100644 --- a/internal/interface/main-handler/subspecialist/handler.go +++ b/internal/interface/main-handler/subspecialist/handler.go @@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) { return } dto := e.ReadDetailDto{} + + sf.UrlQueryParam(&dto, *r.URL) dto.Id = uint16(id) res, err := u.ReadDetail(dto) rw.DataResponse(w, res, err) diff --git a/internal/use-case/main-use-case/specialist/lib.go b/internal/use-case/main-use-case/specialist/lib.go index 10f62ced..3e35d004 100644 --- a/internal/use-case/main-use-case/specialist/lib.go +++ b/internal/use-case/main-use-case/specialist/lib.go @@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e tx = dg.I } - if err := tx.First(&data, input.Id).Error; err != nil { + if err := tx. + Scopes(gh.Preload(input.Includes)). + First(&data, input.Id).Error; err != nil { if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil { return nil, processedErr } diff --git a/internal/use-case/main-use-case/subspecialist/lib.go b/internal/use-case/main-use-case/subspecialist/lib.go index 5843086f..46ec11f2 100644 --- a/internal/use-case/main-use-case/subspecialist/lib.go +++ b/internal/use-case/main-use-case/subspecialist/lib.go @@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e tx = dg.I } - if err := tx.First(&data, input.Id).Error; err != nil { + if err := tx. + Scopes(gh.Preload(input.Includes)). + First(&data, input.Id).Error; err != nil { if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil { return nil, processedErr }