Skip to content

Commit

Permalink
Continue developing log schema
Browse files Browse the repository at this point in the history
  • Loading branch information
dangtony98 committed Dec 18, 2022
1 parent 9d41f75 commit 648e3e3
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions backend/src/models/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import { Schema, model, Types } from 'mongoose';

export interface ILog {
_id: Types.ObjectId;
user: Types.ObjectId;
user?: Types.ObjectId;
workspace: Types.ObjectId;
event: string;
source: string;
ipAddress: string;
ipAddress?: string;
}

// TODO: need a way to store payload info for each
// log

// which secret is being ref etc.

// user logged in

const logSchema = new Schema<ILog>(
{
user: {
Expand All @@ -24,17 +26,25 @@ const logSchema = new Schema<ILog>(
type: Schema.Types.ObjectId,
ref: 'Workspace'
},
event: {
event: { // push, pull
type: String,
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,
enum: ['web', 'cli', 'auto'],
required: true
},
ipAddress: { // store in bytes?
type: String,
required: true
type: String
}
}, {
timestamps: true
Expand Down

0 comments on commit 648e3e3

Please sign in to comment.