Features
Settings Module for Super Admins

SuperAdmin Settings

Saas User Profile

Save SuperAdmin Settings

 model SuperAdminSetting {
  id           Int    @id @default(autoincrement())
  settingName  String @db.VarChar(128)
  settingValue String @db.Text
}
"use server";
 
import { SettingType } from "@/interfaces/billingModule";
import prisma from "@/lib/db";
import { revalidatePath } from "next/cache";
 
export const saveSuperAdminSettings = async (settings: SettingType[]) => {
  try {
    await Promise.all(
      settings.map(async (setting: any) => {
         ...
      })
    )
    ...
    revalidatePath("/admin/settings");
 
    return "ok";
  } catch (error) {
    console.log(error);
 
    return {
      errors: [error],
    };
  }
};
 

Get and use SuperAdmin Settings

const loopId = await getSuperAdminSetting("LOOPS_API_KEY");