streamby-core 0.23.0 → 0.23.1

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.
@@ -146,14 +146,14 @@ function projectRouter(config) {
146
146
  if (!(0, auth_1.isProjectMember)(project, auth.userId)) {
147
147
  return res.status(403).json({ message: 'Unauthorized project access' });
148
148
  }
149
- await Project.delete({ _id: projectId });
149
+ await Project.useDbType(project.dbType).delete({ _id: projectId });
150
150
  const allProjects = await Project.find({});
151
151
  const projects = allProjects
152
- .filter(project => {
153
- const isMember = project.members?.some((m) => m.userId?.toString() === auth.userId?.toString());
152
+ .filter(p => {
153
+ const isMember = p.members?.some((m) => m.userId?.toString() === auth.userId?.toString());
154
154
  return isMember; // Only include projects where the user is a member
155
155
  })
156
- .map(project => mapProjectToResponseFormat(project, auth.userId));
156
+ .map(p => mapProjectToResponseFormat(p, auth.userId));
157
157
  res.status(200).json({ success: true, projects: projects, message: 'Project deleted successfully' });
158
158
  }
159
159
  catch (err) {
@@ -34,11 +34,11 @@ class Model {
34
34
  if (this.tableName === 'projects' && processedFilter.members && processedFilter.members.$elemMatch) {
35
35
  // Handle members filter for SQL projects
36
36
  const userId = processedFilter.members.$elemMatch.userId;
37
- const query = `
38
- SELECT p.*, pm."userId" as memberUserId, pm.archived as memberArchived
39
- FROM "projects" p
40
- JOIN "project_members" pm ON p.id = pm."projectId"
41
- WHERE pm."userId" = $1
37
+ const query = `
38
+ SELECT p.*, pm."userId" as memberUserId, pm.archived as memberArchived
39
+ FROM "projects" p
40
+ JOIN "project_members" pm ON p.id = pm."projectId"
41
+ WHERE pm."userId" = $1
42
42
  `;
43
43
  const result = await connection.query(query, [userId]);
44
44
  sqlResults = result.rows.map(row => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamby-core",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "StreamBy middleware framework for media storage management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",