MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getProfileById

Function getProfileById

packages/db/src/services/profile.service.ts:112–134  ·  view source on GitHub ↗
(id: string, projectId: string)

Source from the content-addressed store, hash-verified

110}
111
112export async function getProfileById(id: string, projectId: string) {
113 if (id === '' || projectId === '') {
114 return null;
115 }
116
117 const cachedProfile = await profileBuffer.fetchFromCache(id, projectId);
118 if (cachedProfile) {
119 return transformProfile(cachedProfile);
120 }
121
122 const [profile] = await chQuery<IClickhouseProfile>(
123 `SELECT ${PROFILE_COLUMNS}
124 FROM ${TABLE_NAMES.profiles} FINAL
125 WHERE id = ${sqlstring.escape(String(id))} AND project_id = ${sqlstring.escape(projectId)}
126 LIMIT 1`
127 );
128
129 if (!profile) {
130 return null;
131 }
132
133 return transformProfile(profile);
134}
135
136interface GetProfileListOptions {
137 projectId: string;

Callers 7

getByIdMethod · 0.90
profile.tsFile · 0.90
incrementProfilePropertyFunction · 0.90
decrementProfilePropertyFunction · 0.90
adjustProfilePropertyFunction · 0.90
profile.tsFile · 0.90

Calls 2

transformProfileFunction · 0.85
fetchFromCacheMethod · 0.45

Tested by

no test coverage detected