mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 22:46:24 +00:00
42 lines
825 B
TypeScript
42 lines
825 B
TypeScript
import { Schema, Types, model } from "mongoose";
|
|
|
|
export interface IAPIKeyData {
|
|
name: string;
|
|
user: Types.ObjectId;
|
|
lastUsed: Date;
|
|
expiresAt: Date;
|
|
secretHash: string;
|
|
}
|
|
|
|
const apiKeyDataSchema = new Schema<IAPIKeyData>(
|
|
{
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
user: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: "User",
|
|
required: true,
|
|
},
|
|
lastUsed: {
|
|
type: Date,
|
|
},
|
|
expiresAt: {
|
|
type: Date,
|
|
},
|
|
secretHash: {
|
|
type: String,
|
|
required: true,
|
|
select: false,
|
|
},
|
|
},
|
|
{
|
|
timestamps: true,
|
|
}
|
|
);
|
|
|
|
const APIKeyData = model<IAPIKeyData>("APIKeyData", apiKeyDataSchema);
|
|
|
|
export default APIKeyData;
|