package Ġcom . gmail . pz ale j ko . invoice . in vo ic ere quest . application Ċ Ċ import Ġcom . gmail . pz ale j ko . invoice . security . model . Invoice User Principal Ċ import Ġio . quarkus . runtime . annotations . Register For Reflection Ċ import Ġjavax . annotation . security . Roles Allowed Ċ import Ġjavax . inject . Inject Ċ import Ġjavax . ws . rs .* Ċ import Ġjavax . ws . rs . core . MediaType Ċ import Ġjavax . enterprise . inject . Default Ċ import Ġjavax . ws . rs . core . Context Ċ import Ġjavax . ws . rs . core . Response Ċ import Ġjavax . ws . rs . core . SecurityContext Ċ Ċ @ Path ("/ api / v 1 / in vo ic ere quest ") Ċ @ Produces ( MediaType . APPLICATION _ JSON ) Ċ @ Cons umes ( MediaType . APPLICATION _ JSON ) Ċ class ĠInvoice Request Controller Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġ@ field : ĠDefault ĊĠĠĠ Ġlateinit Ġvar Ġservice : ĠInvoice Service ĊĊĠĠĠ Ġ@ POST ĊĠĠĠ Ġ@ Roles Allowed (" USER ") ĊĠĠĠ Ġfun Ġcreate ( request : ĠRequest Invoice Command , Ġ@ Context Ġsec : ĠSecurity Context ): ĠResponse Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprincipal Ġ= Ġsec . user Principal Ġas ĠInvoice User Principal ĊĠĠĠĠĠĠĠ Ġval Ġcreated Invoice Request Ġ= Ġservice . request Invoice ( principal . accountId , Ġrequest ) ĊĠĠĠĠĠĠĠ Ġval Ġdto Ġ= ĠRequest Response ( created Invoice Request . getFull Number ()) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠResponse . ok ( dto ). status ( Response . Status . CREATED ). build (); ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Register For Reflection ĊĠĠĠ Ġdata Ġclass ĠRequest Response ( val Ġinvoice Number : ĠString ) Ċ }