(appName: string)
| 106 | }; |
| 107 | |
| 108 | export const validUniqueServerAppName = async (appName: string) => { |
| 109 | const query = await db.query.environments.findMany({ |
| 110 | with: { |
| 111 | applications: { |
| 112 | where: eq(applications.appName, appName), |
| 113 | }, |
| 114 | libsql: { |
| 115 | where: eq(libsql.appName, appName), |
| 116 | }, |
| 117 | mariadb: { |
| 118 | where: eq(mariadb.appName, appName), |
| 119 | }, |
| 120 | mongo: { |
| 121 | where: eq(mongo.appName, appName), |
| 122 | }, |
| 123 | mysql: { |
| 124 | where: eq(mysql.appName, appName), |
| 125 | }, |
| 126 | postgres: { |
| 127 | where: eq(postgres.appName, appName), |
| 128 | }, |
| 129 | redis: { |
| 130 | where: eq(redis.appName, appName), |
| 131 | }, |
| 132 | }, |
| 133 | }); |
| 134 | |
| 135 | // Filter out items with non-empty fields |
| 136 | const nonEmptyProjects = query.filter( |
| 137 | (project) => |
| 138 | project.applications.length > 0 || |
| 139 | project.libsql.length > 0 || |
| 140 | project.mariadb.length > 0 || |
| 141 | project.mongo.length > 0 || |
| 142 | project.mysql.length > 0 || |
| 143 | project.postgres.length > 0 || |
| 144 | project.redis.length > 0, |
| 145 | ); |
| 146 | |
| 147 | return nonEmptyProjects.length === 0; |
| 148 | }; |
no outgoing calls
no test coverage detected