Add api-server and CLI applications
- Create api-server with Bun.serve: - oRPC router with stub handlers for all procedures - Auth middleware placeholder - CORS configuration - Create CLI tool with stricli: - bootstrap command for initial superuser creation - Placeholder commands for auth, user, org management Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
347
apps/api-server/src/router.ts
Normal file
347
apps/api-server/src/router.ts
Normal file
@@ -0,0 +1,347 @@
|
||||
import { implement } from "@orpc/server";
|
||||
import { contract } from "@reviq/api-contract";
|
||||
|
||||
const os = implement(contract);
|
||||
|
||||
// Auth procedures
|
||||
const signup = os.auth.signup.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const verifyEmail = os.auth.verifyEmail.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const resendVerificationEmail = os.auth.resendVerificationEmail.handler(
|
||||
async () => {
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
);
|
||||
|
||||
const createLoginRequest = os.auth.createLoginRequest.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const loginPassword = os.auth.loginPassword.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const loginPasswordConfirm = os.auth.loginPasswordConfirm.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const loginIfRequestIsCompleted = os.auth.loginIfRequestIsCompleted.handler(
|
||||
async () => {
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
);
|
||||
|
||||
const forgotPassword = os.auth.forgotPassword.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const resetPassword = os.auth.resetPassword.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const logout = os.auth.logout.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// WebAuthn procedures
|
||||
const createRegistrationOptions =
|
||||
os.auth.webauthn.createRegistrationOptions.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const verifyRegistration = os.auth.webauthn.verifyRegistration.handler(
|
||||
async () => {
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
);
|
||||
|
||||
const createAuthenticationOptions =
|
||||
os.auth.webauthn.createAuthenticationOptions.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const verifyAuthentication = os.auth.webauthn.verifyAuthentication.handler(
|
||||
async () => {
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
);
|
||||
|
||||
// Me procedures
|
||||
const meGet = os.me.get.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const setupProfile = os.me.setupProfile.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const updateProfile = os.me.updateProfile.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const meDelete = os.me.delete.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const setPassword = os.me.setPassword.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const listPasskeys = os.me.listPasskeys.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const createPasskey = os.me.createPasskey.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const renamePasskey = os.me.renamePasskey.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const deletePasskey = os.me.deletePasskey.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const listSessions = os.me.listSessions.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const revokeSession = os.me.revokeSession.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const revokeAllSessions = os.me.revokeAllSessions.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const getDeviceInfo = os.me.getDeviceInfo.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const trustDevice = os.me.trustDevice.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const listTrustedDevices = os.me.listTrustedDevices.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const untrustDevice = os.me.untrustDevice.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const revokeAllTrustedDevices = os.me.revokeAllTrustedDevices.handler(
|
||||
async () => {
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
);
|
||||
|
||||
// Orgs procedures
|
||||
const orgsList = os.orgs.list.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const orgsCreate = os.orgs.create.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const orgsGet = os.orgs.get.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const orgsUpdate = os.orgs.update.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const orgsDelete = os.orgs.delete.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const orgsLeave = os.orgs.leave.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// Orgs members procedures
|
||||
const membersList = os.orgs.members.list.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const membersUpdateRole = os.orgs.members.updateRole.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const membersRemove = os.orgs.members.remove.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// Orgs invites procedures
|
||||
const invitesList = os.orgs.invites.list.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const invitesCreate = os.orgs.invites.create.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const invitesCancel = os.orgs.invites.cancel.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const invitesAccept = os.orgs.invites.accept.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// Orgs sites procedures
|
||||
const sitesList = os.orgs.sites.list.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// Admin orgs procedures
|
||||
const adminOrgsList = os.admin.orgs.list.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminOrgsGet = os.admin.orgs.get.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminOrgsCreate = os.admin.orgs.create.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminOrgsUpdate = os.admin.orgs.update.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminOrgsDelete = os.admin.orgs.delete.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminOrgsListSites = os.admin.orgs.listSites.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminOrgsAddSite = os.admin.orgs.addSite.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminOrgsRemoveSite = os.admin.orgs.removeSite.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// Admin users procedures
|
||||
const adminUsersList = os.admin.users.list.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminUsersGet = os.admin.users.get.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminUsersCreate = os.admin.users.create.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminUsersUpdate = os.admin.users.update.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
const adminUsersConfirmEmail = os.admin.users.confirmEmail.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// Admin auth procedures
|
||||
const adminAuthCompleteLogin = os.admin.auth.completeLogin.handler(async () => {
|
||||
throw new Error("Not implemented");
|
||||
});
|
||||
|
||||
// Build the router
|
||||
export const router = os.router({
|
||||
auth: {
|
||||
signup,
|
||||
verifyEmail,
|
||||
resendVerificationEmail,
|
||||
createLoginRequest,
|
||||
loginPassword,
|
||||
loginPasswordConfirm,
|
||||
loginIfRequestIsCompleted,
|
||||
forgotPassword,
|
||||
resetPassword,
|
||||
logout,
|
||||
webauthn: {
|
||||
createRegistrationOptions,
|
||||
verifyRegistration,
|
||||
createAuthenticationOptions,
|
||||
verifyAuthentication,
|
||||
},
|
||||
},
|
||||
me: {
|
||||
get: meGet,
|
||||
setupProfile,
|
||||
updateProfile,
|
||||
delete: meDelete,
|
||||
setPassword,
|
||||
listPasskeys,
|
||||
createPasskey,
|
||||
renamePasskey,
|
||||
deletePasskey,
|
||||
listSessions,
|
||||
revokeSession,
|
||||
revokeAllSessions,
|
||||
getDeviceInfo,
|
||||
trustDevice,
|
||||
listTrustedDevices,
|
||||
untrustDevice,
|
||||
revokeAllTrustedDevices,
|
||||
},
|
||||
orgs: {
|
||||
list: orgsList,
|
||||
create: orgsCreate,
|
||||
get: orgsGet,
|
||||
update: orgsUpdate,
|
||||
delete: orgsDelete,
|
||||
leave: orgsLeave,
|
||||
members: {
|
||||
list: membersList,
|
||||
updateRole: membersUpdateRole,
|
||||
remove: membersRemove,
|
||||
},
|
||||
invites: {
|
||||
list: invitesList,
|
||||
create: invitesCreate,
|
||||
cancel: invitesCancel,
|
||||
accept: invitesAccept,
|
||||
},
|
||||
sites: {
|
||||
list: sitesList,
|
||||
},
|
||||
},
|
||||
admin: {
|
||||
orgs: {
|
||||
list: adminOrgsList,
|
||||
get: adminOrgsGet,
|
||||
create: adminOrgsCreate,
|
||||
update: adminOrgsUpdate,
|
||||
delete: adminOrgsDelete,
|
||||
listSites: adminOrgsListSites,
|
||||
addSite: adminOrgsAddSite,
|
||||
removeSite: adminOrgsRemoveSite,
|
||||
},
|
||||
users: {
|
||||
list: adminUsersList,
|
||||
get: adminUsersGet,
|
||||
create: adminUsersCreate,
|
||||
update: adminUsersUpdate,
|
||||
confirmEmail: adminUsersConfirmEmail,
|
||||
},
|
||||
auth: {
|
||||
completeLogin: adminAuthCompleteLogin,
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user