"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
const argon = __importStar(require("@node-rs/argon2"));
const prisma_service_1 = require("../src/prisma/prisma.service");
const prisma = new prisma_service_1.PrismaService();
async function main() {
    console.log("🔐 Updating user passwords...");
    const users = [
        ["fitra@superemas.id", "Fitra0101"],
        ["farhan@superemas.id", "Farhan1212"],
        ["julio@superemas.id", "Julio9999"],
        ["fanny.dwi@superemas.id", "Fanny4422"],
        ["ananda.febiani@superemas.id", "Febi5555"],
        ["faradila.nayafa@superemas.id", "Dila3344"],
        ["sindy.amelia@superemas.id", "Sindy0033"],
        ["tenggo.vanhegar@superemas.id", "Tenggo8787"],
        ["umamsyah.mujidin@superemas.id", "Umam4949"],
        ["adji.putra@superemas.id", "Adji1010"],
        ["thomas.ardho@superemas.id", "Thomas2323"],
        ["syah.rani@superemas.id", "Rani9876"],
        ["alin.arimbi@superemas.id", "Alin1199"],
        ["ananda.pratama@superemas.id", "Nanda5566"],
        ["catherine.rara@superemas.id", "Catherine2525"],
        ["dani.prihat@superemas.id", "Dani7676"],
    ];
    for (const [email, plainPassword] of users) {
        const hashed = await argon.hash(plainPassword);
        const updated = await prisma.user.updateMany({
            where: { email },
            data: { hash: hashed },
        });
        if (updated.count === 0) {
            console.warn(`⚠️ User not found: ${email}`);
        }
        else {
            console.log(`✅ Updated password: ${email}`);
        }
    }
    console.log("🎉 Done updating passwords.");
}
main()
    .catch((e) => {
    console.error("❌ Error:", e);
    process.exit(1);
})
    .finally(async () => {
    await prisma.$disconnect();
});
//# sourceMappingURL=update-password.js.map