MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / put_topic_work

Method put_topic_work

src/opencdeserver/api/app/repository/bcf.py:202–241  ·  view source on GitHub ↗
(tx)

Source from the content-addressed store, hash-verified

200 # implemented
201 def put_topic(self, project_id: UUID, topic_id: UUID, topic: TopicPUT, current_user: User) -> TopicGET:
202 def put_topic_work(tx) -> bool:
203 cypher = """
204 MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)
205 WHERE u.username = $username
206 AND r1.update = True
207 AND p.project_id = $project_id
208 AND t.guid = $topic_id
209 SET t.topic_type = $topic_type,
210 t.topic_status = $topic_status,
211 t.title = $title,
212 t.priority = $priority,
213 t.index = $index,
214 t.modified_date = $modified_date,
215 t.modified_author = $username,
216 t.assigned_to = $assigned_to,
217 t.stage = $stage,
218 t.description = $description,
219 t.due_date = $due_date
220 RETURN t AS topic, ID(t) AS server_assigned_id
221 """
222 result = tx.run(
223 cypher,
224 username=current_user.username,
225 project_id=str(project_id),
226 topic_id=str(topic_id),
227 topic_type=topic.topic_type,
228 topic_status=topic.topic_status,
229 title=topic.title,
230 priority=topic.priority,
231 index=topic.index,
232 modified_date=self.timestamp(),
233 assigned_to=topic.assigned_to,
234 stage=topic.stage,
235 description=topic.description,
236 due_date=topic.due_date,
237 )
238 summary = result.consume()
239 if summary.counters.properties_set < 1:
240 raise HTTPException(status_code=404, detail="Item not found.")
241 return True
242
243 with self.driver.session() as session:
244 session.execute_write(put_topic_work)

Callers

nothing calls this directly

Calls 2

timestampMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected