Skip to content

Commit

Permalink
EY-5030: Sletter ubrukt kode.
Browse files Browse the repository at this point in the history
  • Loading branch information
tvsignal committed Feb 21, 2025
1 parent c910649 commit 895d07c
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class KlageBrevService(
saksbehandler: Saksbehandler,
) {
runBlocking {
brevApiKlient.ferdigstillVedtaksbrev(klage.id, klage.sak.id, saksbehandler)
brevApiKlient.ferdigstillVedtaksbrev(klage.id, saksbehandler)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ interface BrevApiKlient {

suspend fun ferdigstillVedtaksbrev(
behandlingId: UUID,
sakId: SakId,
brukerTokenInfo: BrukerTokenInfo,
)

Expand Down Expand Up @@ -247,7 +246,6 @@ class BrevApiKlientObo(

override suspend fun ferdigstillVedtaksbrev(
behandlingId: UUID,
sakId: SakId, // TODO Fjern ubrukt parameter
brukerTokenInfo: BrukerTokenInfo,
) {
post(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class BrevService(
tilbakekrevingBrevService.ferdigstillVedtaksbrev(behandlingId, brukerTokenInfo)

else -> {
brevApiKlient.ferdigstillVedtaksbrev(behandlingId, SakId(1), brukerTokenInfo)
brevApiKlient.ferdigstillVedtaksbrev(behandlingId, brukerTokenInfo)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ internal class KlageServiceImplTest : BehandlingIntegrationTest() {
hendelseDao = applicationContext.hendelseDao

coEvery { brevApiKlientMock.distribuerBrev(any(), any(), any()) } returns BestillingsIdDto(listOf(randomString()))
coEvery { brevApiKlientMock.ferdigstillVedtaksbrev(any(), any(), any()) } just runs
coEvery { brevApiKlientMock.ferdigstillVedtaksbrev(any(), any()) } just runs
coEvery { brevApiKlientMock.ferdigstillOversendelseBrev(any(), any(), any()) } just runs
coEvery { brevApiKlientMock.hentBrev(any(), any(), any()) } returns randomOpprettetBrevDto()
coEvery { brevApiKlientMock.journalfoerBrev(any(), any(), any()) } returns JournalpostIdDto(listOf(randomString()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import java.time.YearMonth
import java.util.UUID
import kotlin.random.Random

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class BrevRouteIntegrationTest : BehandlingIntegrationTest() {
Expand All @@ -103,20 +102,20 @@ internal class BrevRouteIntegrationTest : BehandlingIntegrationTest() {
private val brevApiKlientMock: BrevApiKlient =
mockk {
coEvery { opprettVedtaksbrev(any(), any<SakId>(), any()) } answers {
opprettetBrevDto(behandlingId = firstArg(), sakId = SakId(secondArg()))
opprettetBrev(behandlingId = firstArg(), sakId = SakId(secondArg()))
}
coEvery { tilbakestillVedtaksbrev(any(), any(), any(), any(), any()) } returns tilbakestiltPayload
coEvery { genererPdf(any(), any(), any()) } returns generertPdf
coEvery { ferdigstillVedtaksbrev(any(), any(), any()) } just runs
coEvery { ferdigstillVedtaksbrev(any(), any()) } just runs
coEvery { hentVedtaksbrev(any(), any()) } answers {
opprettetBrevDto(behandlingId = firstArg())
opprettetBrev(behandlingId = firstArg())
}
}
private val vedtakKlient: VedtakKlient = mockk()
private val brevKlientMock: BrevKlient =
mockk {
coEvery { opprettVedtaksbrev(any(), any(), any()) } answers {
opprettetBrevDto(behandlingId = firstArg())
opprettetBrev(behandlingId = firstArg())
}
coEvery { tilbakestillVedtaksbrev(any(), any(), any(), any()) } returns tilbakestiltPayload
coEvery { ferdigstillVedtaksbrev(any(), any()) } just runs
Expand Down Expand Up @@ -240,14 +239,14 @@ internal class BrevRouteIntegrationTest : BehandlingIntegrationTest() {
withTestApplication { client ->
val response =
client.post(
"/api/behandling/brev/${behandling.id}/vedtak/ferdigstill?brevId=42",
"/api/behandling/brev/${behandling.id}/vedtak/ferdigstill",
) {
addAuthToken(tokenSaksbehandler)
header(HttpHeaders.ContentType, ContentType.Application.Json.toString())
}
response.status shouldBe HttpStatusCode.OK

coVerify { brevApiKlientMock.ferdigstillVedtaksbrev(behandling.id, any(), any()) }
coVerify { brevApiKlientMock.ferdigstillVedtaksbrev(behandling.id, any()) }
}
}

Expand Down Expand Up @@ -465,7 +464,7 @@ internal class BrevRouteIntegrationTest : BehandlingIntegrationTest() {
}
}

private fun opprettetBrevDto(
private fun opprettetBrev(
sakId: SakId = randomSakId(),
behandlingId: UUID = UUID.randomUUID(),
) = Brev(
Expand Down Expand Up @@ -545,40 +544,4 @@ internal class BrevRouteIntegrationTest : BehandlingIntegrationTest() {
VedtakInnholdDto.VedtakTilbakekrevingDto(
tilbakekreving.toObjectNode(),
)

private fun opprettBrev(
status: Status = Status.OPPRETTET,
mottakere: List<Mottaker> = listOf(opprettMottaker(SOEKER_FOEDSELSNUMMER.value)),
) = Brev(
id = Random.nextLong(10000),
sakId = randomSakId(),
behandlingId = null,
tittel = null,
spraak = Spraak.NB,
prosessType = BrevProsessType.REDIGERBAR,
soekerFnr = "fnr",
status = status,
statusEndret = Tidspunkt.now(),
opprettet = Tidspunkt.now(),
mottakere = mottakere,
brevtype = Brevtype.INFORMASJON,
brevkoder = Brevkoder.TOMT_INFORMASJONSBREV,
)

private fun opprettMottaker(fnr: String) =
Mottaker(
id = UUID.randomUUID(),
navn = "Stor Snerk",
foedselsnummer = MottakerFoedselsnummer(fnr),
orgnummer = null,
adresse =
Adresse(
adresseType = "NORSKPOSTADRESSE",
adresselinje1 = "Testgaten 13",
postnummer = "1234",
poststed = "OSLO",
land = "Norge",
landkode = "NOR",
),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ class BrevApiKlientTest : BrevApiKlient {

override suspend fun ferdigstillVedtaksbrev(
behandlingId: UUID,
sakId: SakId,
brukerTokenInfo: BrukerTokenInfo,
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ interface RedigerbartBrevProps {
kanRedigeres: boolean
lukkAdvarselBehandlingEndret?: () => void
tilbakestillingsaction: () => void
tilbakekrevingBrev?: boolean // TODO midlertidig
}

export default function RedigerbartBrev({
brev,
kanRedigeres,
lukkAdvarselBehandlingEndret,
tilbakestillingsaction,
tilbakekrevingBrev = false,
}: RedigerbartBrevProps) {
const [fane, setFane] = useState<string>(kanRedigeres ? ManueltBrevFane.REDIGER : ManueltBrevFane.FORHAANDSVIS)
const [content, setContent] = useState<any[]>([])
Expand Down Expand Up @@ -80,7 +78,6 @@ export default function RedigerbartBrev({
sakId: brev.sakId,
behandlingId: brev.behandlingId,
brevtype: brev.brevtype,
tilbakekrevingBrev,
},
(payload: any) => {
setContent(payload.hoveddel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const Vedtaksbrev = (props: { behandling: IDetaljertBehandling }) => {
if (statusCode === 200) {
setVedtaksbrev(brev)
} else if (statusCode === 204 && redigerbar) {
opprettNyttVedtaksbrev({ sakId, behandlingId, tilbakekrevingBrev: false }, (nyttBrev) => {
opprettNyttVedtaksbrev({ sakId, behandlingId }, (nyttBrev) => {
setVedtaksbrev(nyttBrev)
})
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { formaterSpraak } from '~utils/formatering/formatering'
interface Props {
brev: IBrev
kanRedigeres: boolean
tilbakekrevingBrev?: boolean // TODO
}

export default function BrevSpraak({ brev, kanRedigeres, tilbakekrevingBrev = false }: Props) {
export default function BrevSpraak({ brev, kanRedigeres }: Props) {
const [nyttSpraak, setNyttSpraak] = useState(brev.spraak)

return (
Expand All @@ -27,7 +26,6 @@ export default function BrevSpraak({ brev, kanRedigeres, tilbakekrevingBrev = fa
sakId={brev.sakId}
behandlingId={brev.behandlingId}
brevtype={brev.brevtype}
tilbakekrevingBrev={tilbakekrevingBrev}
/>
)}
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ interface Props {
sakId: number
behandlingId?: string
brevtype: Brevtype
tilbakekrevingBrev: boolean // TODO midlertidig
}

export const BrevSpraakModal = ({
Expand All @@ -26,7 +25,6 @@ export const BrevSpraakModal = ({
sakId,
behandlingId,
brevtype,
tilbakekrevingBrev,
}: Props): ReactNode => {
const [isOpen, setIsOpen] = useState(false)
const [oppdaterSpraakStatus, apiOppdaterSpraak] = useApiCall(oppdaterSpraak)
Expand All @@ -48,7 +46,7 @@ export const BrevSpraakModal = ({
if (spraak) {
apiOppdaterSpraak({ brevId, sakId, spraak }, () => {
if (!!behandlingId) {
apiTilbakestillBrev({ brevId, sakId, behandlingId, brevtype, tilbakekrevingBrev }, () => {
apiTilbakestillBrev({ brevId, sakId, behandlingId, brevtype }, () => {
window.location.reload()
})
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export function TilbakekrevingBrev({
{
behandlingId: behandling.id,
sakId: behandling.sak.id,
tilbakekrevingBrev: true,
},
(nyttBrev) => {
setVedtaksbrev(nyttBrev)
Expand Down Expand Up @@ -77,7 +76,7 @@ export function TilbakekrevingBrev({

{vedtaksbrev && (
<>
<BrevSpraak brev={vedtaksbrev} kanRedigeres={redigerbar} tilbakekrevingBrev={true} />
<BrevSpraak brev={vedtaksbrev} kanRedigeres={redigerbar} />

<BrevMottakerWrapper brev={vedtaksbrev} kanRedigeres={redigerbar} />
</>
Expand All @@ -91,7 +90,6 @@ export function TilbakekrevingBrev({
brev={vedtaksbrev}
kanRedigeres={redigerbar}
tilbakestillingsaction={() => setTilbakestilt(true)}
tilbakekrevingBrev={true}
/>
)}
</BrevContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const ferdigstillVedtaksbrev = async (behandlingId: string): Promise<ApiR
export const opprettVedtaksbrev = async (args: {
sakId: number
behandlingId: string
tilbakekrevingBrev: boolean
}): Promise<ApiResponse<IBrev>> => {
return apiClient.post(`/behandling/brev/${args.behandlingId}/vedtak?sakId=${args.sakId}`, {})
}
Expand Down Expand Up @@ -116,7 +115,6 @@ export const tilbakestillManuellPayload = async (props: {
sakId: number
behandlingId: string
brevtype: Brevtype
tilbakekrevingBrev: boolean
}): Promise<ApiResponse<any>> => {
return apiClient.put(
`/behandling/brev/${props.behandlingId}/vedtak/tilbakestill?brevId=${props.brevId}&sakId=${props.sakId}&brevtype=${props.brevtype}`,
Expand Down

0 comments on commit 895d07c

Please sign in to comment.