Skip to content

Commit

Permalink
Merge pull request #276 from cabcookie:add-learnings-for-accounts
Browse files Browse the repository at this point in the history
chore: extend data schema to allow for storing account learnings
  • Loading branch information
cabcookie authored Dec 19, 2024
2 parents ba6ea5a + 171a96c commit 12b6c63
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 3 deletions.
4 changes: 4 additions & 0 deletions amplify/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const backendType = backend.auth.resources.userPool.node.tryGetContext(

Object.keys(amplifyDynamoDbTables).forEach((key) => {
const setting = tablesWithDeleteProtection.includes(key);
if (!setting)
console.log(
`Not setting delete protection and point-in-time recovery for ${key}`
);
amplifyDynamoDbTables[key].deletionProtectionEnabled =
backendType === "sandbox" ? false : setting;
amplifyDynamoDbTables[key].pointInTimeRecoveryEnabled = setting;
Expand Down
27 changes: 27 additions & 0 deletions amplify/data/account-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,35 @@ const accountSchema = {
resellingAccounts: a.hasMany("PayerAccount", "resellerId"),
people: a.hasMany("PersonAccount", "accountId"),
partnerProjects: a.hasMany("Projects", "partnerId"),
learnings: a.hasMany("AccountLearning", "accountId"),
})
.authorization((allow) => [allow.owner()]),
AccountLearning: a
.model({
owner: a
.string()
.authorization((allow) => [allow.owner().to(["read", "delete"])]),
learnedOn: a.date(),
accountId: a.id().required(),
account: a.belongsTo("Account", "accountId"),
learning: a.json(),
status: a.ref("LearningStatus").required(),
peopleMentioned: a.hasMany("AccountLearningPerson", "learningId"),
})
.authorization((allow) => [allow.owner()])
.secondaryIndexes((index) => [index("accountId")]),
AccountLearningPerson: a
.model({
owner: a
.string()
.authorization((allow) => [allow.owner().to(["read", "delete"])]),
learningId: a.id().required(),
learning: a.belongsTo("AccountLearning", "learningId"),
personId: a.id().required(),
person: a.belongsTo("Person", "personId"),
})
.authorization((allow) => [allow.owner()])
.secondaryIndexes((index) => [index("learningId")]),
};

export default accountSchema;
2 changes: 2 additions & 0 deletions amplify/data/person-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const personSchmema = {
person: a.belongsTo("Person", "personId"),
learning: a.json(),
prayer: a.ref("PrayerStatus"),
status: a.ref("LearningStatus").required(),
})
.secondaryIndexes((index) => [index("personId")])
.authorization((allow) => [allow.owner()]),
Expand Down Expand Up @@ -122,6 +123,7 @@ const personSchmema = {
payerAccounts: a.hasMany("PayerAccount", "mainContactId"),
details: a.hasMany("PersonDetail", "personId"),
learnings: a.hasMany("PersonLearning", "personId"),
accountLearnings: a.hasMany("AccountLearningPerson", "personId"),
profile: a.hasOne("User", "personId"),
noteBlocks: a.hasMany("NoteBlockPerson", "personId"),
relationshipsFrom: a.hasMany("PersonRelationship", "personId"),
Expand Down
1 change: 1 addition & 0 deletions amplify/data/planning-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const tablesWithDeleteProtection = [
"WeeklyPlanProject",
"DailyPlan",
"DailyPlanTodo",
"DailyPlanProject",
];

const planningSchema = {
Expand Down
1 change: 1 addition & 0 deletions amplify/data/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const schema = a
...prayerSchema,
...projectSchema,
...aiSchema,
LearningStatus: a.enum(["new", "archived"]),
InboxStatus: a.enum(["new", "done"]),
Inbox: a
.model({
Expand Down
13 changes: 10 additions & 3 deletions docs/releases/next.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Keine erledigten Projekte auf Tagesliste (Version :VERSION)
# Gelerntes über Unternehmen festhalten (Version :VERSION)

- In der Tagesaufgabenliste werden erledigte Projekte nicht mehr angezeigt.
- Datenbankschema angepasst, um Gelerntes über Unternehmen speichern zu können.

## Weitere Änderungen

## Bekannte Fehler

- Bei längeren Antworten, die der Bot generiert, überschreibt er seine Antwort irgendwann selbst.
- Bei längeren Antworten, die der Chatbot generiert, überschreibt er seine Antwort irgendwann selbst.
- Wenn ein neuer Chat geöffnet wird, könnten während des Ladens Neuigkeiten gestreamt, die von der UI nicht erfasst werden. Dadurch wirkt der Text am Anfang abgehackt.

## In Arbeit

- Gelerntes über eine Organisation kann erfasst werden.
- Etwas Gelerntes über Unternehmen kann als "nicht mehr relevant" markiert werden.
- Etwas Gelerntes über Personen kann als "nicht mehr relevant" markiert werden.

## Geplant

- Chat stabilisieren
Expand Down

0 comments on commit 12b6c63

Please sign in to comment.