streamby-core 0.10.2 → 0.10.3

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.
@@ -97,24 +97,6 @@ function createStreamByRouter(config) {
97
97
  res.status(500).json({ error: 'Failed to list files', details: err });
98
98
  }
99
99
  });
100
- router.patch('/projects/:id', async (req, res) => {
101
- try {
102
- const auth = await config.authProvider(req);
103
- if (auth.role !== 'admin' && auth.role !== 'editor') {
104
- return res.status(403).json({ error: 'Permission denied' });
105
- }
106
- const projectId = req.params.id;
107
- const updates = req.body;
108
- if (!updates || typeof updates !== 'object') {
109
- return res.status(400).json({ error: 'Missing updates payload' });
110
- }
111
- const updated = await config.projectProvider.update(projectId, updates);
112
- res.status(200).json({ success: true, project: updated });
113
- }
114
- catch (err) {
115
- res.status(500).json({ error: 'Failed to update project', details: err.message });
116
- }
117
- });
118
100
  router.get('/projects/:id', async (req, res) => {
119
101
  try {
120
102
  const auth = await config.authProvider(req);
@@ -145,6 +127,24 @@ function createStreamByRouter(config) {
145
127
  res.status(500).json({ error: 'Failed to create project', details: err.message });
146
128
  }
147
129
  });
130
+ router.patch('/projects/:id', async (req, res) => {
131
+ try {
132
+ const auth = await config.authProvider(req);
133
+ if (auth.role !== 'admin' && auth.role !== 'editor') {
134
+ return res.status(403).json({ error: 'Permission denied' });
135
+ }
136
+ const projectId = req.params.id;
137
+ const updates = req.body;
138
+ if (!updates || typeof updates !== 'object') {
139
+ return res.status(400).json({ error: 'Missing updates payload' });
140
+ }
141
+ const updated = await config.projectProvider.update(projectId, updates);
142
+ res.status(200).json({ success: true, project: updated });
143
+ }
144
+ catch (err) {
145
+ res.status(500).json({ error: 'Failed to update project', details: err.message });
146
+ }
147
+ });
148
148
  router.delete('/projects/:id', async (req, res) => {
149
149
  try {
150
150
  const auth = await config.authProvider(req);
@@ -156,8 +156,8 @@ function createStreamByRouter(config) {
156
156
  if (!isProjectMember(project, auth.userId)) {
157
157
  return res.status(403).json({ error: 'Unauthorized project access' });
158
158
  }
159
+ await (0, project_1.deleteProjectService)(req, config.authProvider, config.projectProvider);
159
160
  await config.projectProvider.delete(projectId);
160
- await adapter.deleteProjectDirectory(projectId);
161
161
  res.status(200).json({ success: true });
162
162
  }
163
163
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamby-core",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "StreamBy middleware framework for media storage management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",