mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 15:31:19 +00:00
54 lines
849 B
TypeScript
54 lines
849 B
TypeScript
import { Schema, Types, model } from "mongoose";
|
|
|
|
export interface IWorkspace {
|
|
_id: Types.ObjectId;
|
|
name: string;
|
|
organization: Types.ObjectId;
|
|
environments: Array<{
|
|
name: string;
|
|
slug: string;
|
|
}>;
|
|
autoCapitalization: boolean;
|
|
}
|
|
|
|
const workspaceSchema = new Schema<IWorkspace>({
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
autoCapitalization: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
organization: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: "Organization",
|
|
required: true,
|
|
},
|
|
environments: {
|
|
type: [
|
|
{
|
|
name: String,
|
|
slug: String,
|
|
},
|
|
],
|
|
default: [
|
|
{
|
|
name: "Development",
|
|
slug: "dev",
|
|
},
|
|
{
|
|
name: "Staging",
|
|
slug: "staging",
|
|
},
|
|
{
|
|
name: "Production",
|
|
slug: "prod",
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
const Workspace = model<IWorkspace>("Workspace", workspaceSchema);
|
|
|
|
export default Workspace; |