MCPcopy Create free account
hub / github.com/ShipSecAI/studio / findById

Method findById

backend/src/secrets/secrets.repository.ts:126–161  ·  view source on GitHub ↗
(secretId: string, options: SecretQueryOptions = {})

Source from the content-addressed store, hash-verified

124 }
125
126 async findById(secretId: string, options: SecretQueryOptions = {}): Promise<SecretSummary> {
127 const conditions: SQL[] = [eq(secrets.id, secretId)];
128 if (options.organizationId) {
129 conditions.push(eq(secrets.organizationId, options.organizationId));
130 }
131
132 const whereClause = conditions.length === 1 ? conditions[0] : and(...conditions);
133
134 const rows = await this.db
135 .select({
136 id: secrets.id,
137 name: secrets.name,
138 description: secrets.description,
139 tags: secrets.tags,
140 createdAt: secrets.createdAt,
141 updatedAt: secrets.updatedAt,
142 versionId: secretVersions.id,
143 version: secretVersions.version,
144 versionCreatedAt: secretVersions.createdAt,
145 versionCreatedBy: secretVersions.createdBy,
146 })
147 .from(secrets)
148 .leftJoin(
149 secretVersions,
150 and(eq(secretVersions.secretId, secrets.id), eq(secretVersions.isActive, true)),
151 )
152 .where(whereClause)
153 .limit(1);
154
155 const row = rows[0];
156 if (!row) {
157 throw new NotFoundException(`Secret ${secretId} not found`);
158 }
159
160 return this.mapSummary(row);
161 }
162
163 async findValueBySecretId(
164 secretId: string,

Callers 3

updateSecretMethod · 0.95
getSecretMethod · 0.45
updateSecretMethod · 0.45

Calls 3

mapSummaryMethod · 0.95
fromMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected