(()=>{var e={};e.id=946,e.ids=[946],e.modules={96330:e=>{"use strict";e.exports=require("@prisma/client")},5486:e=>{"use strict";e.exports=require("bcrypt")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},12412:e=>{"use strict";e.exports=require("assert")},79428:e=>{"use strict";e.exports=require("buffer")},55511:e=>{"use strict";e.exports=require("crypto")},94735:e=>{"use strict";e.exports=require("events")},81630:e=>{"use strict";e.exports=require("http")},55591:e=>{"use strict";e.exports=require("https")},11723:e=>{"use strict";e.exports=require("querystring")},79551:e=>{"use strict";e.exports=require("url")},28354:e=>{"use strict";e.exports=require("util")},74075:e=>{"use strict";e.exports=require("zlib")},96186:(e,r,s)=>{"use strict";s.r(r),s.d(r,{patchFetch:()=>v,routeModule:()=>g,serverHooks:()=>f,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>N});var t={};s.r(t),s.d(t,{DELETE:()=>x,GET:()=>l,PUT:()=>m});var o=s(42706),i=s(28203),a=s(45994),n=s(39187),u=s(11587),p=s(64767),d=s(34883);function c(e){return!isNaN(Number(e))}async function l(e,{params:r}){let s=(await r).id;if(!c(s))return n.NextResponse.json({error:"ID inv\xe1lido."},{status:400});try{let e=await u.A.emprego.findUnique({where:{id:Number(s)},include:{ramo:!0,regiao:!0}});if(!e)return n.NextResponse.json({error:"Emprego n\xe3o encontrado."},{status:404});return n.NextResponse.json(e)}catch(e){return console.error("Erro ao buscar emprego:",e),n.NextResponse.json({error:"Erro ao buscar emprego."},{status:500})}}async function m(e,{params:r}){let s=await (0,p.getServerSession)(d.N),t=(await r).id;if(!s)return n.NextResponse.json({error:"N\xe3o autorizado."},{status:401});if(!c(t))return n.NextResponse.json({error:"ID inv\xe1lido."},{status:400});try{let{titulo:r,tipoVaga:s,experiencia:o,localizacao:i,imagem:a,ramoId:p,regiaoId:d}=await e.json();if(!r||!s||!o||!i||!a||!p||!d)return n.NextResponse.json({error:"Todos os campos s\xe3o obrigat\xf3rios."},{status:400});let c=await u.A.emprego.update({where:{id:Number(t)},data:{titulo:r,tipoVaga:s,experiencia:o,localizacao:i,imagem:a,ramoId:Number(p),regiaoId:Number(d)}});return n.NextResponse.json(c)}catch(e){return console.error("Erro ao atualizar emprego:",e),n.NextResponse.json({error:"Erro ao atualizar emprego."},{status:500})}}async function x(e,{params:r}){let s=await (0,p.getServerSession)(d.N),t=(await r).id;if(!s)return n.NextResponse.json({error:"N\xe3o autorizado."},{status:401});if(!c(t))return n.NextResponse.json({error:"ID inv\xe1lido."},{status:400});try{return await u.A.emprego.delete({where:{id:Number(t)}}),n.NextResponse.json({message:"Emprego deletado com sucesso."})}catch(e){return console.error("Erro ao deletar emprego:",e),n.NextResponse.json({error:"Erro ao deletar emprego."},{status:500})}}let g=new o.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/admin/empregos/[id]/route",pathname:"/api/admin/empregos/[id]",filename:"route",bundlePath:"app/api/admin/empregos/[id]/route"},resolvedPagePath:"C:\\Users\\guilh\\Desktop\\plataforma-empregos-NextJs-Ts\\app\\api\\admin\\empregos\\[id]\\route.ts",nextConfigOutput:"",userland:t}),{workAsyncStorage:w,workUnitAsyncStorage:N,serverHooks:f}=g;function v(){return(0,a.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:N})}},96487:()=>{},78335:()=>{},34883:(e,r,s)=>{"use strict";s.d(r,{N:()=>n});var t=s(96330),o=s(91642),i=s(5486);let a=new t.PrismaClient,n={providers:[(0,o.A)({name:"Credentials",credentials:{email:{label:"Email",type:"email"},password:{label:"Password",type:"password"}},async authorize(e){if(!e?.email||!e?.password)throw Error("Credenciais inv\xe1lidas.");let r=await a.admin.findUnique({where:{email:e.email}});if(!r||!await (0,i.compare)(e.password,r.password))throw Error("Credenciais inv\xe1lidas.");return{id:r.id.toString(),username:r.username,email:r.email}}})],callbacks:{jwt:async({token:e,user:r})=>(r&&(e.id=r.id,e.username=r.name,e.email=r.email),e),session:async({session:e,token:r})=>(r&&(e.user={email:r.email}),e)},pages:{signIn:"/admin/login"},secret:process.env.NEXTAUTH_SECRET,session:{strategy:"jwt"}}},11587:(e,r,s)=>{"use strict";s.d(r,{A:()=>t});let t=new(s(96330)).PrismaClient}};var r=require("../../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[638,452,331],()=>s(96186));module.exports=t})();