feat: add community publishing and news syndication
This commit is contained in:
@@ -3,22 +3,63 @@ import { randomUUID } from 'node:crypto';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
const targetName = process.argv[2] || 'Aewyn';
|
||||
const database = await connect(resolve(process.env.TDR_DATABASE_PATH || './data/shd-build.db'));
|
||||
const user = await (await database.prepare(`SELECT users.id,COALESCE(user_profiles.display_name,users.username) AS display_name
|
||||
const database = await connect(
|
||||
resolve(process.env.TDR_DATABASE_PATH || './data/shd-build.db'),
|
||||
);
|
||||
const user = await (
|
||||
await database.prepare(`SELECT users.id,COALESCE(user_profiles.display_name,users.username) AS display_name
|
||||
FROM users LEFT JOIN user_profiles ON user_profiles.user_id=users.id
|
||||
WHERE users.login_username=? COLLATE NOCASE OR users.username=? COLLATE NOCASE OR user_profiles.display_name=? COLLATE NOCASE
|
||||
LIMIT 1`)).get(targetName, targetName, targetName);
|
||||
LIMIT 1`)
|
||||
).get(targetName, targetName, targetName);
|
||||
if (!user) throw new Error(`No user matched ${targetName}.`);
|
||||
const now = Date.now();
|
||||
const samples = [
|
||||
['isac', 'ISAC AVATAR OVERSIGHT', '[TEST] Custom avatar removed', 'Your custom avatar did not meet SHD.build image requirements and was removed. Oversight reason: The image contained unrelated promotional text.', '/account#avatar', 1],
|
||||
['contributions', 'ISAC DATA OVERSIGHT', '[TEST] Contribution approved', 'Quick Draw brand-set data was approved and deployed to the live builder registry.', '/isac/brands', 1],
|
||||
['contributions', 'ISAC DATA OVERSIGHT', '[TEST] Contribution needs revision', 'A talent update was not approved. Oversight reason: Tier II effect value does not match the supplied game evidence.', '/isac/talents', 1],
|
||||
['comments', 'SHD COMMUNITY', '[TEST] New comment on your build', 'An agent commented on “First Wave Vector Critical Build”: This setup worked really well in Legendary missions.', '/builds', 0]
|
||||
[
|
||||
'isac',
|
||||
'ISAC AVATAR OVERSIGHT',
|
||||
'[TEST] Custom avatar removed',
|
||||
'Your custom avatar did not meet SHD.build image requirements and was removed. Oversight reason: The image contained unrelated promotional text.',
|
||||
'/account#avatar',
|
||||
1,
|
||||
],
|
||||
[
|
||||
'contributions',
|
||||
'ISAC DATA OVERSIGHT',
|
||||
'[TEST] Contribution approved',
|
||||
'Quick Draw brand-set data was approved and deployed to the live builder registry.',
|
||||
'/isac/brands',
|
||||
1,
|
||||
],
|
||||
[
|
||||
'contributions',
|
||||
'ISAC DATA OVERSIGHT',
|
||||
'[TEST] Contribution needs revision',
|
||||
'A talent update was not approved. Oversight reason: Tier II effect value does not match the supplied game evidence.',
|
||||
'/isac/talents',
|
||||
1,
|
||||
],
|
||||
[
|
||||
'comments',
|
||||
'SHD COMMUNITY',
|
||||
'[TEST] New comment on your build',
|
||||
'An agent commented on “First Wave Vector Critical Build”: This setup worked really well in Legendary missions.',
|
||||
'/builds',
|
||||
0,
|
||||
],
|
||||
];
|
||||
for (const [index, sample] of samples.entries()) {
|
||||
await (await database.prepare(`INSERT INTO notifications
|
||||
await (
|
||||
await database.prepare(`INSERT INTO notifications
|
||||
(id,user_id,category,source,title,body,link,mandatory,created_at)
|
||||
VALUES(?,?,?,?,?,?,?,?,?)`)).run(randomUUID(), user.id, ...sample, new Date(now - index * 60_000).toISOString());
|
||||
VALUES(?,?,?,?,?,?,?,?,?)`)
|
||||
).run(
|
||||
randomUUID(),
|
||||
user.id,
|
||||
...sample,
|
||||
new Date(now - index * 60_000).toISOString(),
|
||||
);
|
||||
}
|
||||
console.log(`Added ${samples.length} test notifications for ${user.display_name}.`);
|
||||
console.log(
|
||||
`Added ${samples.length} test notifications for ${user.display_name}.`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user