Skip to content

Commit

Permalink
removed url and discovery fields from /add/properties
Browse files Browse the repository at this point in the history
  • Loading branch information
azdak committed Dec 20, 2024
1 parent fe1323d commit b2a5482
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/routes/addProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,40 @@ export const addProperties = async ({ request, reply }) => {
message: 'Property Name is required.',
}
}
else if (!request.body.propertyUrl) {
/* else if (!request.body.propertyUrl) {
return {
status: 'error',
message: 'Property URL is required.',
}
}
else if (!request.body.propertyDiscovery) {
} */
/* else if (!request.body.propertyDiscovery) {
return {
status: 'error',
message: 'Property Discovery settings are required.',
}
}
else if (!validateUrl(request.body.propertyUrl)) {
} */
/* else if (!validateUrl(request.body.propertyUrl)) {
return {
status: 'error',
message: 'Property URL is not valid.',
}
}
else if (!validateDiscovery(request.body.propertyDiscovery)) {
} */
/* else if (!validateDiscovery(request.body.propertyDiscovery)) {
return {
status: 'error',
message: `Property Discovery is not valid- must be one of: ${validateDiscoveryOptions.join(', ')}`,
}
}
} */

await db.connect();
const id = (await db.query(`
INSERT INTO "properties" ("user_id", "name", "discovery", "property_url") VALUES ($1, $2, $3, $4) RETURNING "id"
`, [jwtClaims.sub, request.body.propertyName, request.body.propertyDiscovery, `${request.body.propertyUrl}${(request.body.propertyDiscovery === 'single' && !request.body.propertyUrl.endsWith('/')) ? '/' : ''}`])).rows?.[0]?.id;
INSERT INTO "properties" ("user_id", "name") VALUES ($1, $2, $3, $4) RETURNING "id"
`, [
jwtClaims.sub,
request.body.propertyName,
//request.body.propertyDiscovery,
//`${request.body.propertyUrl}${(request.body.propertyDiscovery === 'single' && !request.body.propertyUrl.endsWith('/')) ? '/' : ''}`
])).rows?.[0]?.id;
await db.clean();

return {
Expand Down

0 comments on commit b2a5482

Please sign in to comment.