@underpostnet/underpost 2.96.1 → 2.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +1 -2
- package/.env.development +0 -3
- package/.env.production +0 -3
- package/.env.test +0 -3
- package/.prettierignore +1 -2
- package/README.md +31 -31
- package/baremetal/commission-workflows.json +64 -17
- package/cli.md +71 -40
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +4 -4
- package/package.json +3 -2
- package/scripts/disk-clean.sh +128 -187
- package/scripts/ipxe-setup.sh +197 -0
- package/scripts/ports-ls.sh +31 -0
- package/scripts/quick-tftp.sh +19 -0
- package/src/api/document/document.controller.js +15 -0
- package/src/api/document/document.model.js +14 -0
- package/src/api/document/document.router.js +1 -0
- package/src/api/document/document.service.js +61 -3
- package/src/cli/baremetal.js +1610 -432
- package/src/cli/cloud-init.js +354 -231
- package/src/cli/cluster.js +1 -1
- package/src/cli/db.js +22 -0
- package/src/cli/deploy.js +6 -2
- package/src/cli/image.js +1 -0
- package/src/cli/index.js +36 -36
- package/src/cli/run.js +77 -11
- package/src/cli/ssh.js +1 -1
- package/src/client/components/core/Input.js +3 -1
- package/src/client/components/core/Panel.js +161 -15
- package/src/client/components/core/PanelForm.js +198 -35
- package/src/client/components/core/Translate.js +11 -0
- package/src/client/services/document/document.service.js +19 -0
- package/src/index.js +1 -1
- package/src/server/dns.js +8 -2
- package/src/server/start.js +14 -6
|
@@ -64,20 +64,39 @@ const DocumentService = {
|
|
|
64
64
|
const lastDoc = await Document.findOne(queryPayload, '_id').sort({ createdAt: 1 });
|
|
65
65
|
const lastId = lastDoc ? lastDoc._id : null;
|
|
66
66
|
|
|
67
|
+
// Add totalCopyShareLinkCount to each document
|
|
68
|
+
const dataWithCounts = data.map((doc) => {
|
|
69
|
+
const docObj = doc.toObject ? doc.toObject() : doc;
|
|
70
|
+
return {
|
|
71
|
+
...docObj,
|
|
72
|
+
totalCopyShareLinkCount: DocumentDto.getTotalCopyShareLinkCount(doc),
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
|
|
67
76
|
return {
|
|
68
|
-
data,
|
|
77
|
+
data: dataWithCounts,
|
|
69
78
|
lastId,
|
|
70
79
|
};
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
switch (req.params.id) {
|
|
74
|
-
default:
|
|
75
|
-
|
|
83
|
+
default: {
|
|
84
|
+
const data = await Document.find({
|
|
76
85
|
userId: req.auth.user._id,
|
|
77
86
|
...(req.params.id ? { _id: req.params.id } : undefined),
|
|
78
87
|
})
|
|
79
88
|
.populate(DocumentDto.populate.file())
|
|
80
89
|
.populate(DocumentDto.populate.mdFile());
|
|
90
|
+
|
|
91
|
+
// Add totalCopyShareLinkCount to each document
|
|
92
|
+
return data.map((doc) => {
|
|
93
|
+
const docObj = doc.toObject ? doc.toObject() : doc;
|
|
94
|
+
return {
|
|
95
|
+
...docObj,
|
|
96
|
+
totalCopyShareLinkCount: DocumentDto.getTotalCopyShareLinkCount(doc),
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
}
|
|
81
100
|
}
|
|
82
101
|
},
|
|
83
102
|
delete: async (req, res, options) => {
|
|
@@ -131,6 +150,45 @@ const DocumentService = {
|
|
|
131
150
|
}
|
|
132
151
|
}
|
|
133
152
|
},
|
|
153
|
+
patch: async (req, res, options) => {
|
|
154
|
+
/** @type {import('./document.model.js').DocumentModel} */
|
|
155
|
+
const Document = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models.Document;
|
|
156
|
+
|
|
157
|
+
if (req.path.includes('/copy-share-link')) {
|
|
158
|
+
const document = await Document.findById(req.params.id);
|
|
159
|
+
if (!document) throw new Error('Document not found');
|
|
160
|
+
|
|
161
|
+
const now = new Date();
|
|
162
|
+
const year = now.getFullYear();
|
|
163
|
+
const month = now.getMonth() + 1; // 0-indexed
|
|
164
|
+
const day = now.getDate();
|
|
165
|
+
|
|
166
|
+
// Find existing entry for this year/month/day
|
|
167
|
+
const existingEventIndex = document.share?.copyShareLinkEvent?.findIndex(
|
|
168
|
+
(event) => event.year === year && event.month === month && event.day === day,
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
if (existingEventIndex !== undefined && existingEventIndex >= 0) {
|
|
172
|
+
// Increment existing count
|
|
173
|
+
document.share.copyShareLinkEvent[existingEventIndex].count += 1;
|
|
174
|
+
} else {
|
|
175
|
+
// Create new entry
|
|
176
|
+
if (!document.share) document.share = {};
|
|
177
|
+
if (!document.share.copyShareLinkEvent) document.share.copyShareLinkEvent = [];
|
|
178
|
+
document.share.copyShareLinkEvent.push({
|
|
179
|
+
year,
|
|
180
|
+
month,
|
|
181
|
+
day,
|
|
182
|
+
count: 1,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
await document.save();
|
|
187
|
+
return document;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
throw new Error('Invalid patch endpoint');
|
|
191
|
+
},
|
|
134
192
|
};
|
|
135
193
|
|
|
136
194
|
export { DocumentService };
|