43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import mongoose from 'mongoose';
|
|
|
|
const pageSpeedTestSchema = new mongoose.Schema({
|
|
url: { type: String, required: true },
|
|
device: { type: String, enum: ['mobile', 'desktop'], required: true },
|
|
scores: {
|
|
performance: Number,
|
|
accessibility: Number,
|
|
bestPractices: Number,
|
|
seo: Number,
|
|
pwa: Number,
|
|
},
|
|
metrics: {
|
|
firstContentfulPaint: String,
|
|
largestContentfulPaint: String,
|
|
totalBlockingTime: String,
|
|
timeToInteractive: String,
|
|
speedIndex: String,
|
|
cumulativeLayoutShift: String,
|
|
},
|
|
opportunities: [
|
|
{
|
|
title: String,
|
|
description: String,
|
|
estimatedSavings: String,
|
|
},
|
|
],
|
|
diagnostics: Object,
|
|
failedAudits: [
|
|
{
|
|
title: String,
|
|
description: String,
|
|
},
|
|
],
|
|
passedAudits: [String],
|
|
notApplicableAudits: [String],
|
|
screenshot: String,
|
|
treemapPath: { type: String },
|
|
createdAt: { type: Date, default: Date.now },
|
|
});
|
|
|
|
export default mongoose.model('PageSpeedTest', pageSpeedTestSchema);
|