mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
Continue developing log schema
This commit is contained in:
@@ -2,11 +2,11 @@ import { Schema, model, Types } from 'mongoose';
|
|||||||
|
|
||||||
export interface ILog {
|
export interface ILog {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
user: Types.ObjectId;
|
user?: Types.ObjectId;
|
||||||
workspace: Types.ObjectId;
|
workspace: Types.ObjectId;
|
||||||
event: string;
|
event: string;
|
||||||
source: string;
|
source: string;
|
||||||
ipAddress: string;
|
ipAddress?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: need a way to store payload info for each
|
// TODO: need a way to store payload info for each
|
||||||
@@ -14,6 +14,8 @@ export interface ILog {
|
|||||||
|
|
||||||
// which secret is being ref etc.
|
// which secret is being ref etc.
|
||||||
|
|
||||||
|
// user logged in
|
||||||
|
|
||||||
const logSchema = new Schema<ILog>(
|
const logSchema = new Schema<ILog>(
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
@@ -24,17 +26,25 @@ const logSchema = new Schema<ILog>(
|
|||||||
type: Schema.Types.ObjectId,
|
type: Schema.Types.ObjectId,
|
||||||
ref: 'Workspace'
|
ref: 'Workspace'
|
||||||
},
|
},
|
||||||
event: {
|
event: { // push, pull
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
source: { // should this just be a payload attr?
|
payload: { // should this just be a payload attr?
|
||||||
|
numberOfSecrets: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
environment: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
channel: {
|
||||||
type: String,
|
type: String,
|
||||||
|
enum: ['web', 'cli', 'auto'],
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
ipAddress: { // store in bytes?
|
ipAddress: { // store in bytes?
|
||||||
type: String,
|
type: String
|
||||||
required: true
|
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
timestamps: true
|
timestamps: true
|
||||||
|
|||||||
Reference in New Issue
Block a user